Refine search
public static <T, E> MergedStereotypes<T, E> of(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager) { return new MergedStereotypes<T, E>(stereotypeAnnotations, manager); }
/** * Is alternative. * * @param annotated the annotated * @param mergedStereotypes merged stereotypes * @return true if alternative, false otherwise */ public static boolean isAlternative(EnhancedAnnotated<?, ?> annotated, MergedStereotypes<?, ?> mergedStereotypes) { return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative(); }
public static <T, E> MergedStereotypes<T, E> of(EnhancedAnnotated<T, E> annotated, BeanManagerImpl manager) { return of(annotated.getMetaAnnotations(Stereotype.class), manager); }
/** * Initializes the name */ protected void initName(EnhancedAnnotated<T, ?> annotated) { boolean beanNameDefaulted = false; if (annotated.isAnnotationPresent(Named.class)) { String javaName = annotated.getAnnotation(Named.class).value(); if ("".equals(javaName)) { beanNameDefaulted = true; } else { this.name = javaName; return; } } if (beanNameDefaulted || (mergedStereotypes != null && mergedStereotypes.isBeanNameDefaulted())) { this.name = getDefaultName(annotated); } }
protected boolean initScopeFromStereotype() { Set<Annotation> possibleScopes = mergedStereotypes.getPossibleScopes(); if (possibleScopes.size() == 1) { this.scope = possibleScopes.iterator().next().annotationType(); return true; } else if (possibleScopes.size() > 1) { String stack; Class<?> declaringClass; if (annotated instanceof EnhancedAnnotatedMember) { EnhancedAnnotatedMember<?, ?, ?> member = (EnhancedAnnotatedMember<?, ?, ?>) annotated; declaringClass = member.getDeclaringType().getJavaClass(); stack = "\n at " + Formats.formatAsStackTraceElement(member.getJavaMember()); } else { declaringClass = annotated.getJavaClass(); stack = ""; } throw BeanLogger.LOG.multipleScopesFoundFromStereotypes(Formats.formatType(declaringClass, false), Formats.formatTypes(mergedStereotypes.getStereotypes(), false), possibleScopes, stack); } else { return false; } }
/** * Constructor * * @param stereotypeAnnotations The stereotypes to merge */ protected MergedStereotypes(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager) { this.possibleScopeTypes = new HashSet<Annotation>(); this.stereotypes = new HashSet<Class<? extends Annotation>>(); this.manager = manager; merge(stereotypeAnnotations); this.stereotypes = SharedObjectCache.instance(manager).getSharedSet(stereotypes); }
public BeanAttributes<T> build() { return new ImmutableBeanAttributes<T>(mergedStereotypes.getStereotypes(), alternative, name, qualifiers, types, scope); } }
protected <S> void initStereotypes(EnhancedAnnotated<T, S> annotated, BeanManagerImpl manager) { this.mergedStereotypes = MergedStereotypes.of(annotated, manager); }
/** * Initializes the name */ protected void initName(EnhancedAnnotated<T, ?> annotated) { boolean beanNameDefaulted = false; if (annotated.isAnnotationPresent(Named.class)) { String javaName = annotated.getAnnotation(Named.class).value(); if ("".equals(javaName)) { beanNameDefaulted = true; } else { this.name = javaName; return; } } if (beanNameDefaulted || (mergedStereotypes != null && mergedStereotypes.isBeanNameDefaulted())) { this.name = getDefaultName(annotated); } }
protected boolean initScopeFromStereotype() { Set<Annotation> possibleScopes = mergedStereotypes.getPossibleScopes(); if (possibleScopes.size() == 1) { this.scope = possibleScopes.iterator().next().annotationType(); return true; } else if (possibleScopes.size() > 1) { String stack; Class<?> declaringClass; if (annotated instanceof EnhancedAnnotatedMember) { EnhancedAnnotatedMember<?, ?, ?> member = (EnhancedAnnotatedMember<?, ?, ?>) annotated; declaringClass = member.getDeclaringType().getJavaClass(); stack = "\n at " + Formats.formatAsStackTraceElement(member.getJavaMember()); } else { declaringClass = annotated.getJavaClass(); stack = ""; } throw BeanLogger.LOG.multipleScopesFoundFromStereotypes(Formats.formatType(declaringClass, false), Formats.formatTypes(mergedStereotypes.getStereotypes(), false), possibleScopes, stack); } else { return false; } }
/** * Constructor * * @param stereotypeAnnotations The stereotypes to merge */ protected MergedStereotypes(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager) { this.possibleScopeTypes = new HashSet<Annotation>(); this.stereotypes = new HashSet<Class<? extends Annotation>>(); this.manager = manager; merge(stereotypeAnnotations); this.stereotypes = SharedObjectCache.instance(manager).getSharedSet(stereotypes); }
public BeanAttributes<T> build() { return new ImmutableBeanAttributes<T>(mergedStereotypes.getStereotypes(), alternative, name, qualifiers, types, scope); } }
protected <S> void initStereotypes(EnhancedAnnotated<T, S> annotated, BeanManagerImpl manager) { this.mergedStereotypes = MergedStereotypes.of(annotated, manager); }
/** * Initializes the name */ protected void initName(EnhancedAnnotated<T, ?> annotated) { boolean beanNameDefaulted = false; if (annotated.isAnnotationPresent(Named.class)) { String javaName = annotated.getAnnotation(Named.class).value(); if ("".equals(javaName)) { beanNameDefaulted = true; } else { this.name = javaName; return; } } if (beanNameDefaulted || (mergedStereotypes != null && mergedStereotypes.isBeanNameDefaulted())) { this.name = getDefaultName(annotated); } }
protected boolean initScopeFromStereotype() { Set<Annotation> possibleScopes = mergedStereotypes.getPossibleScopes(); if (possibleScopes.size() == 1) { this.scope = possibleScopes.iterator().next().annotationType(); return true; } else if (possibleScopes.size() > 1) { String stack; Class<?> declaringClass; if (annotated instanceof EnhancedAnnotatedMember) { EnhancedAnnotatedMember<?, ?, ?> member = (EnhancedAnnotatedMember<?, ?, ?>) annotated; declaringClass = member.getDeclaringType().getJavaClass(); stack = "\n at " + Formats.formatAsStackTraceElement(member.getJavaMember()); } else { declaringClass = annotated.getJavaClass(); stack = ""; } throw BeanLogger.LOG.multipleScopesFoundFromStereotypes(Formats.formatType(declaringClass, false), Formats.formatTypes(mergedStereotypes.getStereotypes(), false), possibleScopes, stack); } else { return false; } }
/** * Is alternative. * * @param annotated the annotated * @param mergedStereotypes merged stereotypes * @return true if alternative, false otherwise */ public static boolean isAlternative(EnhancedAnnotated<?, ?> annotated, MergedStereotypes<?, ?> mergedStereotypes) { return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative(); }
public static <T, E> MergedStereotypes<T, E> of(EnhancedAnnotated<T, E> annotated, BeanManagerImpl manager) { return of(annotated.getMetaAnnotations(Stereotype.class), manager); }
/** * Constructor * * @param stereotypeAnnotations The stereotypes to merge */ protected MergedStereotypes(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager) { this.possibleScopeTypes = new HashSet<Annotation>(); this.stereotypes = new HashSet<Class<? extends Annotation>>(); this.manager = manager; merge(stereotypeAnnotations); this.stereotypes = SharedObjectCache.instance(manager).getSharedSet(stereotypes); }
public BeanAttributes<T> build() { return new ImmutableBeanAttributes<T>(mergedStereotypes.getStereotypes(), alternative, name, qualifiers, types, scope); } }
public static <T, E> MergedStereotypes<T, E> of(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager) { return new MergedStereotypes<T, E>(stereotypeAnnotations, manager); }