private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) { // Type and members if (classInfo.annotations().containsKey(requiredAnnotationName)) { return true; } // Meta-annotations for (DotName annotation : classInfo.annotations().keySet()) { if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) { return true; } } // Superclass final DotName superName = classInfo.superName(); if (superName != null && !OBJECT_NAME.equals(superName)) { final ClassInfo superClassInfo = index.getClassByName(superName); if (superClassInfo == null) { // we are accessing a class that is outside of the jandex index // fallback to using reflection return Reflections.containsAnnotation(loadClass(superName.toString()), requiredAnnotation); } if (containsAnnotation(superClassInfo, requiredAnnotationName, requiredAnnotation)) { return true; } } return false; }
/** * Get the possible beans for the given name * * @param name The name to match * @return The set of matching beans */ public Set<Bean<?>> resolve(final String name) { return resolvedNames.getValue(name); }
/** * Get the possible beans for the given name * * @param name The name to match * @return The set of matching beans */ public Set<Bean<?>> resolve(final String name) { return resolvedNames.getValue(name); }
@Override public Set<Annotation> getDeclaredAnnotationSet(AnnotatedElement element) { return declaredAnnotations.getValue(element).annotationSet; }
/** * Get the possible beans for the given name * * @param name The name to match * @return The set of matching beans */ public Set<Bean<?>> resolve(final String name) { return resolvedNames.getValue(name); }
private SpecializedBeanResolver getSpecializedBeanResolver(RIBean<?> bean) { return specializedBeanResolvers.getValue(bean.getBeanManager()); } }
public Set<Annotation> applyScopeInheritanceRules(Set<Annotation> annotations, Class<?> javaClass) { Set<Annotation> result = new HashSet<Annotation>(); for (Annotation annotation : annotations) { if (!isScopeAnnotation.getValue(annotation.annotationType())) { result.add(annotation); } } result.addAll(findTopLevelScopeDefinitions(javaClass)); return ImmutableSet.copyOf(result); }
public void destroy(Object instance) { if (instance != null) { final InjectionTarget<Object> it = cast(cache.getValue(instance.getClass())); it.dispose(instance); } } }
/** * * @param annotation * @return the qualifier instance for the given annotation, uses cache if possible */ public QualifierInstance getQualifierInstance(final Annotation annotation) { return isCacheAllowed(annotation) ? qualifierInstanceCache.getValue(annotation) : QualifierInstance.of(annotation, this); }
/** * * @param annotation * @return the qualifier instance for the given annotation, uses cache if possible */ public QualifierInstance getQualifierInstance(final Annotation annotation) { return isCacheAllowed(annotation) ? qualifierInstanceCache.getValue(annotation) : QualifierInstance.of(annotation, this); }
/** * Subclasses are allowed to override the default behavior, i.e. to cache an instance per BeanManager. * * @return the {@link Instance} the relevant calls are delegated to */ protected WeldInstance<T> getInstance() { return instanceCache.getValue(BeanManagerProxy.unwrap(getBeanManager())); }
/** * Subclasses are allowed to override the default behavior, i.e. to cache an instance per BeanManager. * * @return the {@link Instance} the relevant calls are delegated to */ protected WeldInstance<T> getInstance() { return instanceCache.getValue(BeanManagerProxy.unwrap(getBeanManager())); }
/** * * @param annotation * @return the qualifier instance for the given annotation, uses cache if possible */ public QualifierInstance getQualifierInstance(final Annotation annotation) { return isCacheAllowed(annotation) ? qualifierInstanceCache.getValue(annotation) : QualifierInstance.of(annotation, this); }
/** * Subclasses are allowed to override the default behavior, i.e. to cache instance per BeanManager. * * @return the {@link Instance} the relevant calls are delegated to */ protected WeldInstance<T> getInstance() { return instanceCache.getValue(BeanManagerProxy.unwrap(getBeanManager())); }
/** * * @param annotation * @return the qualifier instance for the given annotation, uses cache if possible */ public QualifierInstance getQualifierInstance(final Annotation annotation) { return isCacheAllowed(annotation) ? qualifierInstanceCache.getValue(annotation) : QualifierInstance.of(annotation, this); }
/** * Subclasses are allowed to override the default behavior, i.e. to cache an instance per BeanManager. * * @return the {@link Instance} the relevant calls are delegated to */ protected WeldInstance<T> getInstance() { return instanceCache.getValue(BeanManagerProxy.unwrap(getBeanManager())); }
/** * * @param annotation * @return the qualifier instance for the given annotation, uses cache if possible */ public QualifierInstance getQualifierInstance(final Annotation annotation) { return isCacheAllowed(annotation) ? qualifierInstanceCache.getValue(annotation) : QualifierInstance.of(annotation, this); }
protected void inject(Object instance) { final InjectionTarget<Object> it = cast(cache.getValue(instance.getClass())); CreationalContext<Object> cc = manager.createCreationalContext(null); it.inject(instance, cc); }
@Override public BeanManagerProxy getBeanManager() { ContainerState state = container.getState(); if (state.equals(ContainerState.STOPPED) || state.equals(ContainerState.SHUTDOWN)) { throw BeanManagerLogger.LOG.beanManagerNotAvailable(); } return beanManagers.getValue(getCallingClassName()); }
@Override public BeanManagerProxy getBeanManager() { ContainerState state = container.getState(); if (state.equals(ContainerState.STOPPED) || state.equals(ContainerState.SHUTDOWN)) { throw BeanManagerLogger.LOG.beanManagerNotAvailable(); } return beanManagers.getValue(getCallingClassName()); }