org.jboss.errai.codegen.meta.MetaClass.getFullyQualifiedNameWithTypeParms()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中org.jboss.errai.codegen.meta.MetaClass.getFullyQualifiedNameWithTypeParms()方法的一些代码示例,展示了MetaClass.getFullyQualifiedNameWithTypeParms()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getFullyQualifiedNameWithTypeParms()方法的具体详情如下:
包路径:org.jboss.errai.codegen.meta.MetaClass
类名称:MetaClass
方法名:getFullyQualifiedNameWithTypeParms

MetaClass.getFullyQualifiedNameWithTypeParms介绍

暂无

代码示例

代码示例来源:origin: errai/errai

@Override
public String toString() {
 return String.format("%s %s", getQualifier(), getInjectedType().getFullyQualifiedNameWithTypeParms());
}

代码示例来源:origin: errai/errai

@Override
 public String toString() {
  return String.format("%s %s", getQualifier(), getType().getFullyQualifiedNameWithTypeParms());
 }
}

代码示例来源:origin: errai/errai

return String.format("%s %s %s", injectableDescriptor, getQualifier(), getInjectedType().getFullyQualifiedNameWithTypeParms());

代码示例来源:origin: org.jboss.errai/errai-codegen

sb.append(i.getFullyQualifiedNameWithTypeParms());
sb.append(dc.getFullyQualifiedNameWithTypeParms());

代码示例来源:origin: errai/errai

sb.append(i.getFullyQualifiedNameWithTypeParms());
sb.append(dc.getFullyQualifiedNameWithTypeParms());

代码示例来源:origin: errai/errai

if (m != null) {
 e.appendFailureInfo("This value came from method " +
    m.getDeclaringClass().getFullyQualifiedNameWithTypeParms() + "." + m.getName() +
    ", which has return type " + m.getReturnType());

代码示例来源:origin: org.jboss.errai/errai-codegen

if (m != null) {
 e.appendFailureInfo("This value came from method " +
    m.getDeclaringClass().getFullyQualifiedNameWithTypeParms() + "." + m.getName() +
    ", which has return type " + m.getReturnType());

代码示例来源:origin: errai/errai

@Test
public void testFieldWithStringTypeParam() throws Exception {
 final MetaClass metaClass = getMetaClass(ClassWithGenericCollections.class);
 final MetaField field = metaClass.getDeclaredField("hasStringParam");
 assertNotNull(field);
 assertEquals("Collection", field.getType().getName());
 assertEquals("java.util.Collection", field.getType().getFullyQualifiedName());
 assertEquals("<java.lang.String>", field.getType().getParameterizedType().toString());
 assertEquals("java.util.Collection<java.lang.String>", field.getType().getFullyQualifiedNameWithTypeParms());
 assertEquals("java.util.Collection", field.getType().getErased().getFullyQualifiedNameWithTypeParms());
 assertEquals(
     Arrays.asList(getMetaClass(String.class)),
     Arrays.asList(field.getType().getParameterizedType().getTypeParameters()));
}

代码示例来源:origin: errai/errai

@Test
public void testMethodObjectReturnType() {
 final MetaClass c = getMetaClass(ClassWithGenericMethods.class);
 final MetaMethod method = c.getMethod("methodReturningObject", new Class[] {});
 assertEquals("java.lang.Object", method.getReturnType().getFullyQualifiedNameWithTypeParms());
 assertEquals(getTypeOfMetaClassBeingTested(), method.getReturnType().getClass());
 // the generic return type should be the same: plain old Object
 assertEquals(getMetaClass(Object.class), method.getGenericReturnType());
}

代码示例来源:origin: errai/errai

@Test
public void testFieldWithStringBoundedWildcardTypeParam() throws Exception {
 final MetaClass metaClass = getMetaClass(ClassWithGenericCollections.class);
 final MetaField field = metaClass.getDeclaredField("hasWildcardExtendsStringParam");
 assertNotNull(field);
 assertEquals("Collection", field.getType().getName());
 assertEquals("java.util.Collection", field.getType().getFullyQualifiedName());
 assertEquals("<? extends java.lang.String>", field.getType().getParameterizedType().toString());
 assertEquals("java.util.Collection<? extends java.lang.String>", field.getType().getFullyQualifiedNameWithTypeParms());
 assertEquals("java.util.Collection", field.getType().getErased().getFullyQualifiedNameWithTypeParms());
 assertEquals(1, field.getType().getParameterizedType().getTypeParameters().length);
 final MetaWildcardType typeParam = (MetaWildcardType) field.getType().getParameterizedType().getTypeParameters()[0];
 assertEquals("Should have no lower bound",
     Arrays.asList(),
     Arrays.asList(typeParam.getLowerBounds()));
 assertEquals("Upper bound should be java.lang.String",
     Arrays.asList(getMetaClass(String.class)),
     Arrays.asList(typeParam.getUpperBounds()));
}

代码示例来源:origin: errai/errai

@Test
public void testEraseParameterizedTopLevelType() throws Exception {
 final MetaClass parameterized = getMetaClass(ParameterizedClass.class);
 assertEquals("ParameterizedClass", parameterized.getName());
 assertEquals("org.jboss.errai.codegen.test.model.ParameterizedClass", parameterized.getFullyQualifiedName());
 assertNull(parameterized.getParameterizedType());
 // I think this would be correct, but right now we get the raw type name
 //assertEquals("org.jboss.errai.codegen.test.model.ParameterizedClass<T>", parameterized.getFullyQualifiedNameWithTypeParms());
 assertEquals("org.jboss.errai.codegen.test.model.ParameterizedClass", parameterized.getErased().getFullyQualifiedNameWithTypeParms());
}

代码示例来源:origin: errai/errai

@Test
public void testMethodReturnTypeWithUpperBoundedWildcardParameter() {
 final MetaClass c = getMetaClass(ClassWithGenericMethods.class);
 final MetaMethod method = c.getMethod("methodReturningUpperBoundedWildcardCollection", new Class[] {});
 // TODO (ERRAI-459) decide whether it's correct to have the type param present or not
 // then adjust this assertion to strict equality rather than startsWith()
 assertTrue(method.getReturnType().getFullyQualifiedNameWithTypeParms().startsWith("java.util.Collection"));
 final MetaType genericReturnType = method.getGenericReturnType();
 assertNotNull(genericReturnType);
 assertTrue("Got unexpected return type type " + genericReturnType.getClass(),
     genericReturnType instanceof MetaParameterizedType);
 final MetaParameterizedType mpReturnType = (MetaParameterizedType) genericReturnType;
 assertEquals(1, mpReturnType.getTypeParameters().length);
 // Sole type parameter should be <? extends String>
 assertTrue(mpReturnType.getTypeParameters()[0] instanceof MetaWildcardType);
 final MetaWildcardType typeParam = (MetaWildcardType) mpReturnType.getTypeParameters()[0];
 assertArrayEquals(new MetaType[] {}, typeParam.getLowerBounds());
 assertArrayEquals(new MetaType[] { getMetaClass(String.class) }, typeParam.getUpperBounds());
}

代码示例来源:origin: errai/errai

@Test
public void testFieldWithUnboundedTypeVarParam() throws Exception {
 final MetaClass metaClass = getMetaClass(ClassWithGenericCollections.class);
 final MetaField field = metaClass.getDeclaredField("hasUnboundedTypeVarFromClass");
 assertNotNull(field);
 assertEquals("Collection", field.getType().getName());
 assertEquals("java.util.Collection", field.getType().getFullyQualifiedName());
 assertEquals("java.util.Collection<T>", field.getType().getParameterizedType().getName());
 assertEquals("java.util.Collection<T>", field.getType().getFullyQualifiedNameWithTypeParms());
 assertEquals("java.util.Collection", field.getType().getErased().getFullyQualifiedNameWithTypeParms());
 assertEquals(1, field.getType().getParameterizedType().getTypeParameters().length);
 final MetaTypeVariable typeVar = (MetaTypeVariable) field.getType().getParameterizedType().getTypeParameters()[0];
 assertEquals("T", typeVar.getName());
 assertEquals("Should have no upper bound",
     Arrays.asList(getMetaClass(Object.class)),
     Arrays.asList(typeVar.getBounds()));
}

代码示例来源:origin: errai/errai

@Test
public void testMethodReturnTypeWithWildcardParameter() {
 final MetaClass c = getMetaClass(ClassWithGenericMethods.class);
 final MetaMethod method = c.getMethod("methodReturningUnboundedWildcardCollection", new Class[] {});
 // TODO (ERRAI-459) decide whether it's correct to have the type param present or not
 // then adjust this assertion to strict equality rather than startsWith()
 assertTrue(method.getReturnType().getFullyQualifiedNameWithTypeParms().startsWith("java.util.Collection"));
 final MetaType genericReturnType = method.getGenericReturnType();
 assertNotNull(genericReturnType);
 assertTrue("Got unexpected return type type " + genericReturnType.getClass(),
     genericReturnType instanceof MetaParameterizedType);
 final MetaParameterizedType mpReturnType = (MetaParameterizedType) genericReturnType;
 assertEquals(1, mpReturnType.getTypeParameters().length);
 // Sole type parameter should be <?>
 assertTrue(mpReturnType.getTypeParameters()[0] instanceof MetaWildcardType);
 final MetaWildcardType typeParam = (MetaWildcardType) mpReturnType.getTypeParameters()[0];
 assertArrayEquals(new MetaType[] {}, typeParam.getLowerBounds());
 assertArrayEquals(new MetaType[] { getMetaClass(Object.class) }, typeParam.getUpperBounds());
}

代码示例来源:origin: errai/errai

@Test
public void testMethodReturnTypeWithLowerBoundedWildcardParameter() {
 final MetaClass c = getMetaClass(ClassWithGenericMethods.class);
 final MetaMethod method = c.getMethod("methodReturningLowerBoundedWildcardCollection", new Class[] {});
 // TODO (ERRAI-459) decide whether it's correct to have the type param present or not
 // then adjust this assertion to strict equality rather than startsWith()
 assertTrue(method.getReturnType().getFullyQualifiedNameWithTypeParms().startsWith("java.util.Collection"));
 final MetaType genericReturnType = method.getGenericReturnType();
 assertNotNull(genericReturnType);
 assertTrue("Got unexpected return type type " + genericReturnType.getClass(),
     genericReturnType instanceof MetaParameterizedType);
 final MetaParameterizedType mpReturnType = (MetaParameterizedType) genericReturnType;
 assertEquals(1, mpReturnType.getTypeParameters().length);
 // Sole type parameter should be <? extends String>
 assertTrue(mpReturnType.getTypeParameters()[0] instanceof MetaWildcardType);
 final MetaWildcardType typeParam = (MetaWildcardType) mpReturnType.getTypeParameters()[0];
 assertArrayEquals(new MetaType[] { getMetaClass(String.class) }, typeParam.getLowerBounds());
 assertArrayEquals(new MetaType[] { getMetaClass(Object.class)}, typeParam.getUpperBounds());
}

相关文章