org.apache.webbeans.annotation
Class AnnotationManager

java.lang.Object
  extended by org.apache.webbeans.annotation.AnnotationManager

public final class AnnotationManager
extends Object

Manages annotation usage by classes in this application.


Constructor Summary
AnnotationManager(WebBeansContext context)
           
 
Method Summary
 void checkDecoratorResolverParams(Set<Type> apiTypes, Annotation... qualifiers)
           
 Annotation[] checkForNewQualifierForDeployment(Type type, Class<?> clazz, String name, Annotation[] annotations)
          Check conditions for the new binding.
 void checkInjectionPointForInjectInjectionPoint(Class<?> clazz)
          JavaEE components can not inject InjectionPoint.
 void checkInterceptorResolverParams(Annotation... interceptorBindings)
           
 void checkQualifierConditions(Annotation... qualifierAnnots)
           
 void checkQualifierConditions(Set<Annotation> qualifierAnnots)
          This function obviously cannot check for duplicate annotations.
 void checkStereoTypeClass(Class<? extends Annotation> clazz, Annotation... annotations)
          Validates that given class obeys stereotype model defined by the specification.
<X> Annotation[]
getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
           
 Annotation getDeclaredScopeAnnotation(Class<?> beanClass)
           
<X> Method
getDisposalWithGivenAnnotatedMethod(AnnotatedType<X> annotatedType, Type beanType, Annotation[] qualifiers)
           
 Set<Annotation> getInterceptorAnnotations(Set<Annotation> typeAnns)
          This method searches for all direct and indirect annotations which represent an InterceptorBinding.
 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)
          Gets the array of qualifier annotations on the given array.
 Set<Annotation> getQualifierAnnotations(Set<Annotation> annotations)
           
 Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
           
 Set<Class<? extends Annotation>> getStereotypeMetaAnnotations(Set<Class<? extends Annotation>> stereotypes)
          Same like getStereotypeMetaAnnotations(java.util.Set) but with an array
 Set<Class<? extends Annotation>> getStereotypes(Set<Class<? extends Annotation>> anns)
          Returns bean stereotypes.
 boolean hasInterceptorBindingMetaAnnotation(Annotation[] anns)
          If any Annotations in the input is an interceptor binding annotation type then return true, false otherwise.
 boolean hasNamedOnStereoTypes(Set<Class<? extends Annotation>> stereotypes)
          Returns true if name exists,false otherwise.
 boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
           
 boolean hasStereoTypeMetaAnnotation(Set<Class<? extends Annotation>> anns)
           
 boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz)
          Returns true if the annotation is defined in xml or annotated with InterceptorBinding or an InterceptorBinding registered via BeforeBeanDiscovery.
 boolean isQualifierAnnotation(Class<? extends Annotation> clazz)
          Returns true if the annotation is defined in xml or annotated with Qualifier false otherwise.
 boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
          Returns true if the annotation is defined in xml or annotated with Stereotype false otherwise.
 boolean isSuperMethodNamed(AbstractOwbBean<?> component, Method method, Method superMethod)
          Configures the name of the producer method for specializing the parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 with InterceptorBinding or an InterceptorBinding registered via BeforeBeanDiscovery. 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 an InterceptorBinding. 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 with Qualifier false otherwise.

Parameters:
clazz - type of the annotation
Returns:
true if the annotation is defined in xml or annotated with Qualifier false otherwise

getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation

public <X> Annotation[] getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(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 - method
clazz - checking annotation
Returns:
annotation array

getQualifierAnnotations

public Set<Annotation> getQualifierAnnotations(Set<Annotation> annotations)

getQualifierAnnotations

public Annotation[] getQualifierAnnotations(Annotation... annotations)
Gets the array of qualifier annotations on the given array.

Parameters:
annotations - 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 -

isStereoTypeAnnotation

public boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
Returns true if the annotation is defined in xml or annotated with Stereotype false otherwise.

Parameters:
clazz - type of the annotation
Returns:
true if the annotation is defined in xml or annotated with Stereotype false 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 like getStereotypeMetaAnnotations(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)

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 component
method - specialized producer method
superMethod - overriden super producer method

getDisposalWithGivenAnnotatedMethod

public <X> Method getDisposalWithGivenAnnotatedMethod(AnnotatedType<X> annotatedType,
                                                      Type beanType,
                                                      Annotation[] qualifiers)

checkInjectionPointForInjectInjectionPoint

public void checkInjectionPointForInjectInjectionPoint(Class<?> clazz)
JavaEE components can not inject InjectionPoint.

Parameters:
clazz - javaee component class info
Throws:
WebBeansConfigurationException - exception if condition is not applied


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.