本文整理了Java中org.jboss.errai.codegen.meta.MetaClass.getSuperClass()
方法的一些代码示例,展示了MetaClass.getSuperClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getSuperClass()
方法的具体详情如下:
包路径:org.jboss.errai.codegen.meta.MetaClass
类名称:MetaClass
方法名:getSuperClass
暂无
代码示例来源:origin: errai/errai
private int getDistanceFromObject(MetaClass type) {
int distance = 0;
for (; type.getSuperClass() != null; type = type.getSuperClass()) {
distance++;
}
return distance;
}
});
代码示例来源:origin: errai/errai
private static List<MetaField> getAllFields(MetaClass c) {
ArrayList<MetaField> fields = new ArrayList<MetaField>();
for (; c != null; c = c.getSuperClass()) {
fields.addAll(Arrays.asList(c.getDeclaredFields()));
}
return fields;
}
代码示例来源:origin: org.jboss.errai/errai-navigation
private static List<MetaField> getAllFields(MetaClass c) {
ArrayList<MetaField> fields = new ArrayList<MetaField>();
for (; c != null; c = c.getSuperClass()) {
fields.addAll(Arrays.asList(c.getDeclaredFields()));
}
return fields;
}
代码示例来源:origin: errai/errai
private static void fillInInterfacesAndSuperTypes(final Set<MetaClass> set, final MetaClass type) {
for (final MetaClass iface : type.getInterfaces()) {
set.add(iface);
fillInInterfacesAndSuperTypes(set, iface);
}
if (type.getSuperClass() != null) {
fillInInterfacesAndSuperTypes(set, type.getSuperClass());
}
}
代码示例来源:origin: errai/errai
private void resolveTypeSpecialization(final InjectableImpl specialization, final Set<InjectableImpl> toBeRemoved) {
final MetaClass specializedType = specialization.type.getSuperClass().getErased();
for (final InjectableReference injectable : directInjectableReferencesByAssignableTypes.get(specializedType)) {
if (injectable.type.equals(specializedType)) {
if (!injectable.linked.isEmpty()) {
updateSpecializedReferenceLinks(specialization, toBeRemoved, injectable);
break;
}
}
}
}
代码示例来源:origin: org.jboss.errai/errai-config
private static void fillInInterfacesAndSuperTypes(final Set<MetaClass> set, final MetaClass type) {
for (final MetaClass iface : type.getInterfaces()) {
set.add(iface);
fillInInterfacesAndSuperTypes(set, iface);
}
if (type.getSuperClass() != null) {
fillInInterfacesAndSuperTypes(set, type.getSuperClass());
}
}
代码示例来源:origin: org.jboss.errai/errai-codegen
@Override
public final List<MetaField> getFieldsAnnotatedWith(final Class<? extends Annotation> annotation) {
final List<MetaField> fields = new ArrayList<>();
MetaClass scanTarget = this;
while (scanTarget != null) {
for (final MetaField m : scanTarget.getDeclaredFields()) {
if (m.isAnnotationPresent(annotation)) {
fields.add(m);
}
}
scanTarget = scanTarget.getSuperClass();
}
return Collections.unmodifiableList(fields);
}
代码示例来源:origin: errai/errai
@Override
public final List<MetaField> getFieldsAnnotatedWith(final Class<? extends Annotation> annotation) {
final List<MetaField> fields = new ArrayList<>();
MetaClass scanTarget = this;
while (scanTarget != null) {
for (final MetaField m : scanTarget.getDeclaredFields()) {
if (m.isAnnotationPresent(annotation)) {
fields.add(m);
}
}
scanTarget = scanTarget.getSuperClass();
}
return Collections.unmodifiableList(fields);
}
代码示例来源:origin: errai/errai
private static void addSuperTypesAndInterfaces(final MetaClass metaClass, final Collection<MetaClass> supersAndIfaces) {
if (metaClass == null) {
return;
}
supersAndIfaces.add(metaClass);
addSuperTypesAndInterfaces(metaClass.getSuperClass(), supersAndIfaces);
addInterfaces(metaClass, supersAndIfaces);
}
代码示例来源:origin: org.jboss.errai/errai-codegen
private static void addSuperTypesAndInterfaces(final MetaClass metaClass, final Collection<MetaClass> supersAndIfaces) {
if (metaClass == null) {
return;
}
supersAndIfaces.add(metaClass);
addSuperTypesAndInterfaces(metaClass.getSuperClass(), supersAndIfaces);
addInterfaces(metaClass, supersAndIfaces);
}
代码示例来源:origin: errai/errai
static MetaMethod getOverridenMethod(final MetaMethod specializingMethod) {
final MetaClass[] producerParams = GraphUtil.getParameterTypes(specializingMethod);
MetaClass enclosingType = specializingMethod.getDeclaringClass();
MetaMethod specializedMethod = null;
while (specializedMethod == null && enclosingType.getSuperClass() != null) {
enclosingType = enclosingType.getSuperClass();
specializedMethod = enclosingType.getDeclaredMethod(specializingMethod.getName(), producerParams);
}
return specializedMethod;
}
代码示例来源:origin: errai/errai
@Override
public List<MetaMethod> getMethodsWithMetaAnnotations(final Class<? extends Annotation> annotation) {
final List<MetaMethod> methods = new ArrayList<>();
MetaClass scanTarget = this;
while (scanTarget != null) {
for (final MetaMethod m : scanTarget.getDeclaredMethods()) {
for (final Annotation a : m.getAnnotations()) {
if (_findMetaAnnotation(a.annotationType(), annotation)) {
methods.add(m);
}
}
}
scanTarget = scanTarget.getSuperClass();
}
return methods;
}
代码示例来源:origin: errai/errai
@Override
public boolean isDefaultInstantiableSubtypeOf(final String fqcn) {
if (!isPublic() || !isDefaultInstantiable()) {
return false;
}
MetaClass type = this;
while (type != null && !type.getFullyQualifiedName().equals(fqcn)) {
type = type.getSuperClass();
}
return type != null;
}
代码示例来源:origin: org.jboss.errai/errai-codegen
@Override
public boolean isDefaultInstantiableSubtypeOf(final String fqcn) {
if (!isPublic() || !isDefaultInstantiable()) {
return false;
}
MetaClass type = this;
while (type != null && !type.getFullyQualifiedName().equals(fqcn)) {
type = type.getSuperClass();
}
return type != null;
}
代码示例来源:origin: org.jboss.errai/errai-codegen
@Override
public List<MetaParameter> getParametersAnnotatedWith(final Class<? extends Annotation> annotation) {
final List<MetaParameter> methods = new ArrayList<>();
MetaClass scanTarget = this;
while (scanTarget != null) {
for (final MetaConstructor m : scanTarget.getDeclaredConstructors()) {
methods.addAll(m.getParametersAnnotatedWith(annotation));
}
for (final MetaMethod m : scanTarget.getDeclaredMethods()) {
methods.addAll(m.getParametersAnnotatedWith(annotation));
}
scanTarget = scanTarget.getSuperClass();
}
return methods;
}
代码示例来源:origin: errai/errai
/**
* Recursive subroutine of {@link #fillInheritanceMap(org.jboss.errai.codegen.meta.MetaClass)}.
*/
private static void fillInheritanceMap(final Multimap<String, String> inheritanceMap,
final MetaClass visiting,
final MetaClass mappingClass) {
if (visiting == null || visiting.equals(MetaClassFactory.get(Object.class)))
return;
if (!visiting.equals(mappingClass)) {
inheritanceMap.put(visiting.getFullyQualifiedName(), mappingClass.getFullyQualifiedName());
}
fillInheritanceMap(inheritanceMap, visiting.getSuperClass(), mappingClass);
for (final MetaClass iface : visiting.getInterfaces()) {
fillInheritanceMap(inheritanceMap, iface, mappingClass);
}
}
代码示例来源:origin: errai/errai
public static int scoreInterface(final MetaClass parm, final MetaClass arg) {
if (parm.isInterface()) {
final MetaClass[] iface = arg.getInterfaces();
if (iface != null) {
for (final MetaClass c : iface) {
if (c == parm) return 1;
else if (parm.isAssignableFrom(c)) return scoreInterface(parm, arg.getSuperClass());
}
}
}
return 0;
}
代码示例来源:origin: org.jboss.errai/errai-codegen
public static int scoreInterface(final MetaClass parm, final MetaClass arg) {
if (parm.isInterface()) {
final MetaClass[] iface = arg.getInterfaces();
if (iface != null) {
for (final MetaClass c : iface) {
if (c == parm) return 1;
else if (parm.isAssignableFrom(c)) return scoreInterface(parm, arg.getSuperClass());
}
}
}
return 0;
}
代码示例来源:origin: errai/errai
@Test
public void testHashCodeErrorWithGenericHavingArrayUpperBound() throws Exception {
final MetaClass mc = getMetaClass(ClassWithArrayGenerics.class).getField("field").getType();
// Precondition
assertNotNull("Failed to find field with type under test.", mc);
assertNotNull("Type should be parameterized", mc.getParameterizedType());
final MetaClass superClassWithProblematicBound = mc.getSuperClass();
try {
superClassWithProblematicBound.hashCode();
} catch (final Throwable t) {
throw new AssertionError("An error occurred.", t);
}
}
代码示例来源:origin: errai/errai
@Test
public void testSuperClass() throws Exception {
final MetaClass child = getMetaClass(Child.class);
final MetaClass parent = child.getSuperClass();
assertEquals(getMetaClass(Parent.class), parent);
}
内容来源于网络,如有侵权,请联系作者删除!