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.
 boolean checkInjectionPointForInterceptorPassivation(Class<?> clazz)
          Returns trur for serializable types.
 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)
          Validates that given class obeys stereotype model defined by the specification.
 void checkStereoTypeClass(Class<? extends Annotation> clazz, Annotation... annotations)
          Validates that given class obeys stereotype model defined by the specification.
 boolean configuredProducerSpecializedName(AbstractOwbBean<?> component, Method method, Method superMethod)
          Configures the name of the producer method for specializing the parent.
<X> Annotation[]
getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
           
 Annotation[] getComponentStereoTypes(OwbBean<?> bean)
          Returns bean stereotypes.
<X> Method
getDisposalWithGivenAnnotatedMethod(javax.enterprise.inject.spi.AnnotatedType<X> annotatedType, Type beanType, Annotation[] qualifiers)
           
 Annotation[] getInterceptorBindingMetaAnnotations(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.
 Annotation[] getRealizesGenericAnnotations(Class<?> clazz, Annotation[] anns)
          If the bean extends generic class via Realizes annotation, realized based producer methods, fields and observer methods qualifier is Qualifiers on the definitions Plus class qualifiers Minus generic class qualifiers
 Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
           
 boolean hasInterceptorBindingMetaAnnotation(Annotation[] anns)
          If any Annotations in the input is an interceptor binding annotation type then return true, false otherwise.
 boolean hasNamedOnStereoTypes(OwbBean<?> bean)
          Returns true if name exists,false otherwise.
 boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
           
 boolean isComponentHasStereoType(OwbBean<?> component)
          Returns true if array contains the StereoType meta annotation
 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.
 
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

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

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(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(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 - method
clazz - checking annotation
Returns:
annotation array

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

getRealizesGenericAnnotations

public Annotation[] getRealizesGenericAnnotations(Class<?> clazz,
                                                  Annotation[] anns)
If the bean extends generic class via Realizes annotation, realized based producer methods, fields and observer methods qualifier is

Parameters:
clazz - realized definition class
anns - binding annotations array

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(Annotation[] anns)

getStereotypeMetaAnnotations

public Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)

isComponentHasStereoType

public boolean isComponentHasStereoType(OwbBean<?> component)
Returns true if array contains the StereoType meta annotation

Returns:
true if array contains the StereoType meta annotation

getComponentStereoTypes

public Annotation[] getComponentStereoTypes(OwbBean<?> bean)
Returns bean stereotypes.

Parameters:
bean - bean instance
Returns:
bean stereotypes

hasNamedOnStereoTypes

public boolean hasNamedOnStereoTypes(OwbBean<?> bean)
Returns true if name exists,false otherwise.

Parameters:
bean - bean instance
Returns:
true if name exists

checkStereoTypeClass

public void checkStereoTypeClass(Class<? extends Annotation> clazz)
Validates that given class obeys stereotype model defined by the specification.

Parameters:
clazz - stereotype class

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

configuredProducerSpecializedName

public boolean configuredProducerSpecializedName(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(javax.enterprise.inject.spi.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

checkInjectionPointForInterceptorPassivation

public boolean checkInjectionPointForInterceptorPassivation(Class<?> clazz)
Returns trur for serializable types.

Parameters:
clazz - class info
Returns:
true if class is serializable


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.