@Override public <A extends Annotation> A getAnnotation(final Class<A> annotation) { return annotated.getAnnotation(annotation); }
public default boolean isAnnotationPresent(final Class<? extends Annotation> annotation) { return getAnnotation(annotation) != null; }
public default boolean isAnnotationPresent(final Class<? extends Annotation> annotation) { return getAnnotation(annotation) != null; }
private Predicate<List<InjectableHandle>> getPathPredicate(final HasAnnotations annotated, final List<String> problems) { if (annotated.isAnnotationPresent(Typed.class)) { final Class<?>[] beanTypes = annotated.getAnnotation(Typed.class).value(); validateAssignableTypes(annotated, beanTypes, problems); return path -> Object.class.getName().equals(path.get(0)) || Arrays.stream(beanTypes) .anyMatch(beanType -> path.get(0).getType().getFullyQualifiedName().equals(beanType.getName())); } else { return ANY; } }
public static AbstractStatementBuilder getAssignableTypesArrayStmt(final Injectable injectable) { final Object[] assignableTypes = injectable.getAnnotatedObject() .flatMap(annotated -> Optional.ofNullable(annotated.getAnnotation(Typed.class))) .map(typedAnno -> typedAnno.value()) // Ensure that Object is an assignable type .map(beanTypes -> { if (Arrays.stream(beanTypes).anyMatch(type -> Object.class.equals(type))) { return (Object[]) beanTypes; } else { final Class<?>[] copyWithObject = Arrays.copyOf(beanTypes, beanTypes.length+1); copyWithObject[beanTypes.length] = Object.class; return (Object[]) copyWithObject; } }) .orElseGet(() -> getAllAssignableTypes(injectable.getInjectedType()).stream().filter(MetaClass::isPublic).toArray()); return newArray(Class.class).initialize(assignableTypes); }
decorator.getClass().getAnnotation(CodeDecorator.class).order(), elemType, () -> { final Decorable decorable = new Decorable(annotated, annotated.getAnnotation(annoType), Decorable.DecorableType.fromElementType(elemType), injectionContext, builder.getClassDefinition().getContext(), builder.getClassDefinition(), injectable);