Package org.apache.webbeans.annotation
Class AnnotationManager
- java.lang.Object
-
- org.apache.webbeans.annotation.AnnotationManager
-
public final class AnnotationManager extends Object
Manages annotation usage by classes in this application.
-
-
Constructor Summary
Constructors Constructor Description AnnotationManager(WebBeansContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckDecoratorResolverParams(Set<Type> apiTypes, Annotation... qualifiers)Annotation[]checkForNewQualifierForDeployment(Type type, Class<?> clazz, String name, Annotation[] annotations)Check conditions for the new binding.voidcheckInjectionPointForInjectInjectionPoint(Class<?> clazz)JavaEE components can not injectInjectionPoint.voidcheckInterceptorResolverParams(Annotation... interceptorBindings)voidcheckQualifierConditions(Annotation ann)voidcheckQualifierConditions(Annotation... qualifierAnnots)voidcheckQualifierConditions(Set<Annotation> qualifierAnnots)This function obviously cannot check for duplicate annotations.voidcheckQualifiersParams(Set<Type> apiTypes, Annotation... qualifiers)voidcheckStereoTypeClass(Class<? extends Annotation> clazz, Annotation... annotations)Validates that given class obeys stereotype model defined by the specification.voidclearCaches()<X> Annotation[]getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)AnnotationgetDeclaredScopeAnnotation(Class<?> beanClass)<X> MethodgetDisposalWithGivenAnnotatedMethod(javax.enterprise.inject.spi.AnnotatedType<X> annotatedType, Type beanType, Annotation[] qualifiers)Set<Annotation>getInterceptorAnnotations(Set<Annotation> typeAnns)This method searches for all direct and indirect annotations which represent anInterceptorBinding.Annotation[]getInterceptorBindingMetaAnnotations(Annotation[] anns)Collect the interceptor bindings from an array of annotations, including transitively defined interceptor bindings.Annotation[]getInterceptorBindingMetaAnnotations(Set<Annotation> anns)Collect the interceptor bindings from an array of annotations, including transitively defined interceptor bindings.Annotation[]getMethodFirstParameterQualifierWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)Gets the method first found parameter qualifiers.Annotation[]getQualifierAnnotations(Annotation... annotations)Set<Annotation>getQualifierAnnotations(Collection<Annotation> anns)Gets the array of qualifier annotations on the given array.Optional<Method>getRepeatableMethod(Class<?> type)Annotation[]getStereotypeMetaAnnotations(Annotation[] anns)Set<Class<? extends Annotation>>getStereotypeMetaAnnotations(Set<Class<? extends Annotation>> stereotypes)Same likegetStereotypeMetaAnnotations(java.util.Set)but with an arraySet<Class<? extends Annotation>>getStereotypes(Set<Class<? extends Annotation>> anns)Returns bean stereotypes.booleanhasInterceptorBindingMetaAnnotation(Annotation[] anns)If any Annotations in the input is an interceptor binding annotation type then return true, false otherwise.booleanhasNamedOnStereoTypes(Set<Class<? extends Annotation>> stereotypes)Returns true if name exists,false otherwise.booleanhasStereoTypeMetaAnnotation(Annotation[] anns)booleanhasStereoTypeMetaAnnotation(Set<Class<? extends Annotation>> anns)booleanisInterceptorBindingAnnotation(Class<? extends Annotation> clazz)Returns true if the annotation is defined in xml or annotated withInterceptorBindingor an InterceptorBinding registered viaBeforeBeanDiscovery.booleanisQualifierAnnotation(Class<? extends Annotation> clazz)Returns true if the annotation is defined in xml or annotated withQualifierfalse otherwise.booleanisStereoTypeAnnotation(Class<? extends Annotation> clazz)Returns true if the annotation is defined in xml or annotated withStereotypefalse otherwise.booleanisSuperMethodNamed(AbstractOwbBean<?> component, Method method, Method superMethod)Configures the name of the producer method for specializing the parent.protected MethodresolveRepeatableMethod(Class<?> type)
-
-
-
Constructor Detail
-
AnnotationManager
public AnnotationManager(WebBeansContext context)
-
-
Method Detail
-
getDeclaredScopeAnnotation
public Annotation getDeclaredScopeAnnotation(Class<?> beanClass)
-
isInterceptorBindingAnnotation
public boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz)
Returns true if the annotation is defined in xml or annotated withInterceptorBindingor an InterceptorBinding registered viaBeforeBeanDiscovery. False otherwise.- Parameters:
clazz- type of the annotation- Returns:
- true if the annotation is defined in xml or annotated with
InterceptorBinding, false otherwise
-
getInterceptorAnnotations
public Set<Annotation> getInterceptorAnnotations(Set<Annotation> typeAnns)
This method searches for all direct and indirect annotations which represent anInterceptorBinding. InterceptorBindings in stereotypes will also be found!- Returns:
- the effective interceptor annotations of the array of given annotations
-
hasInterceptorBindingMetaAnnotation
public boolean hasInterceptorBindingMetaAnnotation(Annotation[] anns)
If any Annotations in the input is an interceptor binding annotation type then return true, false otherwise.- Parameters:
anns- array of Annotations to check- Returns:
- true if one or moe of the input annotations are an interceptor binding annotation type false otherwise
-
getInterceptorBindingMetaAnnotations
public Annotation[] getInterceptorBindingMetaAnnotations(Set<Annotation> anns)
Collect the interceptor bindings from an array of annotations, including transitively defined interceptor bindings.- Parameters:
anns- An array of annotations- Returns:
- an array of interceptor binding annotations, including the input and any transitively declared annotations
-
getInterceptorBindingMetaAnnotations
public Annotation[] getInterceptorBindingMetaAnnotations(Annotation[] anns)
Collect the interceptor bindings from an array of annotations, including transitively defined interceptor bindings.- Parameters:
anns- An array of annotations- Returns:
- an array of interceptor binding annotations, including the input and any transitively declared annotations
-
isQualifierAnnotation
public boolean isQualifierAnnotation(Class<? extends Annotation> clazz)
Returns true if the annotation is defined in xml or annotated withQualifierfalse otherwise.- Parameters:
clazz- type of the annotation- Returns:
- true if the annotation is defined in xml or annotated with
Qualifierfalse otherwise
-
getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation
public <X> Annotation[] getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
-
getMethodFirstParameterQualifierWithGivenAnnotation
public Annotation[] getMethodFirstParameterQualifierWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)
Gets the method first found parameter qualifiers.- Parameters:
method- methodclazz- checking annotation- Returns:
- annotation array
-
getQualifierAnnotations
public Annotation[] getQualifierAnnotations(Annotation... annotations)
-
getQualifierAnnotations
public Set<Annotation> getQualifierAnnotations(Collection<Annotation> anns)
Gets the array of qualifier annotations on the given array.- Parameters:
anns- annotation array- Returns:
- array containing qualifier anns
-
checkQualifierConditions
public void checkQualifierConditions(Annotation... qualifierAnnots)
-
checkQualifierConditions
public void checkQualifierConditions(Set<Annotation> qualifierAnnots)
This function obviously cannot check for duplicate annotations. So this must have been done before!- Parameters:
qualifierAnnots-
-
checkQualifierConditions
public void checkQualifierConditions(Annotation ann)
-
isStereoTypeAnnotation
public boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
Returns true if the annotation is defined in xml or annotated withStereotypefalse otherwise.- Parameters:
clazz- type of the annotation- Returns:
- true if the annotation is defined in xml or annotated with
Stereotypefalse otherwise
-
hasStereoTypeMetaAnnotation
public boolean hasStereoTypeMetaAnnotation(Set<Class<? extends Annotation>> anns)
-
hasStereoTypeMetaAnnotation
public boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
-
getStereotypeMetaAnnotations
public Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
-
getStereotypeMetaAnnotations
public Set<Class<? extends Annotation>> getStereotypeMetaAnnotations(Set<Class<? extends Annotation>> stereotypes)
Same likegetStereotypeMetaAnnotations(java.util.Set)but with an array
-
getStereotypes
public Set<Class<? extends Annotation>> getStereotypes(Set<Class<? extends Annotation>> anns)
Returns bean stereotypes.- Returns:
- bean stereotypes
-
hasNamedOnStereoTypes
public boolean hasNamedOnStereoTypes(Set<Class<? extends Annotation>> stereotypes)
Returns true if name exists,false otherwise.- Returns:
- true if name exists
-
checkStereoTypeClass
public void checkStereoTypeClass(Class<? extends Annotation> clazz, Annotation... annotations)
Validates that given class obeys stereotype model defined by the specification.- Parameters:
clazz- stereotype class
-
checkInterceptorResolverParams
public void checkInterceptorResolverParams(Annotation... interceptorBindings)
-
checkDecoratorResolverParams
public void checkDecoratorResolverParams(Set<Type> apiTypes, Annotation... qualifiers)
-
checkQualifiersParams
public void checkQualifiersParams(Set<Type> apiTypes, Annotation... qualifiers)
-
checkForNewQualifierForDeployment
public Annotation[] checkForNewQualifierForDeployment(Type type, Class<?> clazz, String name, Annotation[] annotations)
Check conditions for the new binding.- Parameters:
annotations- annotations- Returns:
- Annotation[] with all binding annotations
- Throws:
WebBeansConfigurationException- if New plus any other binding annotation is set
-
isSuperMethodNamed
public boolean isSuperMethodNamed(AbstractOwbBean<?> component, Method method, Method superMethod)
Configures the name of the producer method for specializing the parent.- Parameters:
component- producer method componentmethod- specialized producer methodsuperMethod- overriden super producer method
-
getDisposalWithGivenAnnotatedMethod
public <X> Method getDisposalWithGivenAnnotatedMethod(javax.enterprise.inject.spi.AnnotatedType<X> annotatedType, Type beanType, Annotation[] qualifiers)
-
checkInjectionPointForInjectInjectionPoint
public void checkInjectionPointForInjectInjectionPoint(Class<?> clazz)
JavaEE components can not injectInjectionPoint.- Parameters:
clazz- javaee component class info- Throws:
WebBeansConfigurationException- exception if condition is not applied
-
clearCaches
public void clearCaches()
-
-