@Override default @Nonnull Optional<Class<? extends Annotation>> getDeclaredAnnotationTypeByStereotype(String stereotype) { return getAnnotationMetadata().getDeclaredAnnotationTypeByStereotype(stereotype); }
@Override default @Nonnull Optional<Class<? extends Annotation>> getDeclaredAnnotationTypeByStereotype(@Nonnull Class<? extends Annotation> stereotype) { return getAnnotationMetadata().getDeclaredAnnotationTypeByStereotype(stereotype); }
/** * Find the first declared annotation name for the given stereotype. * * @param stereotype The stereotype * @return The annotation name */ default @Nonnull Optional<Class<? extends Annotation>> getDeclaredAnnotationTypeByStereotype(@Nonnull Class<? extends Annotation> stereotype) { ArgumentUtils.requireNonNull("stereotype", stereotype); return getDeclaredAnnotationTypeByStereotype(stereotype.getName()); }
@SuppressWarnings("unchecked") @Override public Optional<Class<? extends Annotation>> getScope() { return getAnnotationMetadata().getDeclaredAnnotationTypeByStereotype(Scope.class); }
@SuppressWarnings("unchecked") @Override public Optional<Class<? extends Annotation>> getScope() { return getAnnotationMetadata().getDeclaredAnnotationTypeByStereotype(Scope.class); }
public static boolean isSingleton(AnnotationMetadata annotationMetadata) { if (annotationMetadata.isAnnotationPresent(EachProperty.class) || annotationMetadata.isAnnotationPresent(EachBean.class)) { return true; } final Optional<Class<? extends Annotation>> scope = annotationMetadata.getDeclaredAnnotationTypeByStereotype(Scope.class); // is singleton logic return (scope.isPresent() && scope.get() == Singleton.class) || annotationMetadata.getValue(DefaultScope.class, Singleton.class).isPresent(); }