public static Collection<MetaClass> getAllAssignableTypes(final MetaClass injectedType) { return injectedType.getAllSuperTypesAndInterfaces(); }
private MetaClass getConstraintValidatorIface(final MetaClass validator) { final Optional<MetaClass> ifaceOptional = validator.getAllSuperTypesAndInterfaces().stream() .filter(iface -> iface.getFullyQualifiedName().equals(ConstraintValidator.class.getName())).findAny(); if (!ifaceOptional.isPresent()) { throw new RuntimeException("Tried to generate dynamic validator for type that isn't a ConstraintValidator: " + validator.getFullyQualifiedName()); } return ifaceOptional.get(); } }
private void processAssignableTypes(final InjectableReference injectableReference) { for (final MetaClass assignable : injectableReference.type.getAllSuperTypesAndInterfaces()) { try { directInjectableReferencesByAssignableTypes.put(assignable.getErased(), injectableReference); } catch (final Throwable t) { throw new RuntimeException("Error occurred adding the assignable type " + assignable.getFullyQualifiedName(), t); } } }
private void validateAssignableTypes(final HasAnnotations annotated, final Class<?>[] beanTypes, final List<String> problems) { MetaClass actualRawType; if (annotated instanceof MetaClass) { actualRawType = ((MetaClass) annotated).getErased(); } else if (annotated instanceof MetaField) { actualRawType = ((MetaField) annotated).getType().getErased(); } else if (annotated instanceof MetaMethod) { actualRawType = ((MetaMethod) annotated).getReturnType().getErased(); } else { throw new IllegalArgumentException("Unrecognized element kind annotated with @Typed: " + annotated); } final Set<String> assignableTypeNames = actualRawType .getAllSuperTypesAndInterfaces() .stream() .map(type -> type.getFullyQualifiedName()) .collect(Collectors.toSet()); final Optional<String> unassignableTypes = Arrays .stream(beanTypes) .map(Class::getName) .filter(name -> !assignableTypeNames.contains(name)) .reduce((s1, s2) -> s1 + "\n" + s2); unassignableTypes.ifPresent(typeNameString -> problems.add( String.format("The @Typed declaration on [%s] contained the following types not assignable to [%s]:\n%s", annotated, actualRawType, typeNameString))); }
parameterContainingType = fromType; else for (final MetaClass type : fromType.getAllSuperTypesAndInterfaces()) { if (type.isInterface() && type.getFullyQualifiedName().equals(toType.getFullyQualifiedName())) { parameterContainingType = type;
stmts.add(loadVariable("windowContext").invoke("addBeanProvider", injectable.getInjectedType().getFullyQualifiedName(), createJsTypeProviderFor(injectable))); for (final MetaClass mc : injectable.getInjectedType().getAllSuperTypesAndInterfaces()) { if (mc.isPublic() && !mc.equals(injectable.getInjectedType()) && !mc.getFullyQualifiedName().equals("java.lang.Object") && mc.isAnnotationPresent(JsType.class)) {