Class AbstractEnhancedAnnotated<T,S>
- java.lang.Object
-
- org.jboss.weld.annotated.enhanced.jlr.AbstractEnhancedAnnotated<T,S>
-
- Type Parameters:
T-S-
- All Implemented Interfaces:
Annotated,EnhancedAnnotated<T,S>
- Direct Known Subclasses:
AbstractEnhancedAnnotatedMember,EnhancedAnnotatedParameterImpl,EnhancedAnnotatedTypeImpl
public abstract class AbstractEnhancedAnnotated<T,S> extends Object implements EnhancedAnnotated<T,S>
Represents functionality common for all annotated items, mainly different mappings of the annotations and meta-annotations AbstractAnnotatedItem is an immutable class and therefore threadsafe- Author:
- Pete Muir, Nicklas Karlsson
- See Also:
EnhancedAnnotated
-
-
Field Summary
-
Fields inherited from interface org.jboss.weld.annotated.enhanced.EnhancedAnnotated
MAPPED_DECLARED_METAANNOTATIONS, MAPPED_METAANNOTATIONS
-
-
Constructor Summary
Constructors Constructor Description AbstractEnhancedAnnotated(Annotated annotated, Map<Class<? extends Annotation>,Annotation> annotationMap, Map<Class<? extends Annotation>,Annotation> declaredAnnotationMap, ClassTransformer classTransformer)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static voidaddMetaAnnotations(SetMultimap<Class<? extends Annotation>,Annotation> metaAnnotationMap, Annotation annotation, Iterable<Annotation> metaAnnotations, boolean declared)protected static Map<Class<? extends Annotation>,Annotation>buildAnnotationMap(Iterable<Annotation> annotations)Builds the annotation map (annotation type -> annotation)Type[]getActualTypeArguments()Gets the actual type arguments for any parameterized types that this AnnotatedItem represents.<A extends Annotation>
AgetAnnotation(Class<A> annotationType)Get program element annotation of a certain annotation type.Set<Annotation>getAnnotations()Get all annotations of the program element.TypegetBaseType()Get the type of the annotated program element.Annotation[]getBindingsAsArray()Deprecated.abstract SgetDelegate()Set<Type>getInterfaceClosure()Get the type hierarchy of any interfaces implemented by this class.Class<T>getJavaClass()Gets the type of the elementSet<Annotation>getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)Gets all annotations which are annotated with the given meta annotation typeSet<Annotation>getQualifiers()Deprecated.Set<Type>getTypeClosure()Get all types to which the base type should be considered assignable.booleanisAnnotationPresent(Class<? extends Annotation> annotationType)Determine if the program element has an annotation of a certain annotation type.booleanisParameterizedType()booleanisPrimitive()protected voidprocessMetaAnnotations(SetMultimap<Class<? extends Annotation>,Annotation> metaAnnotationMap, Annotation[] annotations, ClassTransformer classTransformer, boolean declared)protected voidprocessMetaAnnotations(SetMultimap<Class<? extends Annotation>,Annotation> metaAnnotationMap, Annotation annotation, ClassTransformer classTransformer, boolean declared)protected voidprocessMetaAnnotations(SetMultimap<Class<? extends Annotation>,Annotation> metaAnnotationMap, Collection<Annotation> annotations, ClassTransformer classTransformer, boolean declared)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.enterprise.inject.spi.Annotated
getAnnotations
-
Methods inherited from interface org.jboss.weld.annotated.enhanced.EnhancedAnnotated
getName, getPackage, isFinal, isGeneric, isPackagePrivate, isPrivate, isPublic, isStatic, slim
-
-
-
-
Constructor Detail
-
AbstractEnhancedAnnotated
public AbstractEnhancedAnnotated(Annotated annotated, Map<Class<? extends Annotation>,Annotation> annotationMap, Map<Class<? extends Annotation>,Annotation> declaredAnnotationMap, ClassTransformer classTransformer)
Constructor Also builds the meta-annotation map. Throws a NullPointerException if trying to register a null map- Parameters:
annotationMap- A map of annotation to register
-
-
Method Detail
-
buildAnnotationMap
protected static Map<Class<? extends Annotation>,Annotation> buildAnnotationMap(Iterable<Annotation> annotations)
Builds the annotation map (annotation type -> annotation)- Parameters:
annotations- The array of annotations to map- Returns:
- The annotation map
-
addMetaAnnotations
protected static void addMetaAnnotations(SetMultimap<Class<? extends Annotation>,Annotation> metaAnnotationMap, Annotation annotation, Iterable<Annotation> metaAnnotations, boolean declared)
-
processMetaAnnotations
protected void processMetaAnnotations(SetMultimap<Class<? extends Annotation>,Annotation> metaAnnotationMap, Collection<Annotation> annotations, ClassTransformer classTransformer, boolean declared)
-
processMetaAnnotations
protected void processMetaAnnotations(SetMultimap<Class<? extends Annotation>,Annotation> metaAnnotationMap, Annotation[] annotations, ClassTransformer classTransformer, boolean declared)
-
processMetaAnnotations
protected void processMetaAnnotations(SetMultimap<Class<? extends Annotation>,Annotation> metaAnnotationMap, Annotation annotation, ClassTransformer classTransformer, boolean declared)
-
getJavaClass
public Class<T> getJavaClass()
Description copied from interface:EnhancedAnnotatedGets the type of the element- Specified by:
getJavaClassin interfaceEnhancedAnnotated<T,S>- Returns:
- The type of the element
-
getActualTypeArguments
public Type[] getActualTypeArguments()
Description copied from interface:EnhancedAnnotatedGets the actual type arguments for any parameterized types that this AnnotatedItem represents.- Specified by:
getActualTypeArgumentsin interfaceEnhancedAnnotated<T,S>- Returns:
- An array of type arguments
-
getInterfaceClosure
public Set<Type> getInterfaceClosure()
Description copied from interface:EnhancedAnnotatedGet the type hierarchy of any interfaces implemented by this class. The returned types should have any type parameters resolved to their actual types. There is no guarantee this methods executes in O(1) time- Specified by:
getInterfaceClosurein interfaceEnhancedAnnotated<T,S>- Returns:
- the type hierarchy
-
getDelegate
public abstract S getDelegate()
-
isParameterizedType
public boolean isParameterizedType()
- Specified by:
isParameterizedTypein interfaceEnhancedAnnotated<T,S>
-
isPrimitive
public boolean isPrimitive()
- Specified by:
isPrimitivein interfaceEnhancedAnnotated<T,S>
-
getBaseType
public Type getBaseType()
Description copied from interface:AnnotatedGet the type of the annotated program element.
- Specified by:
getBaseTypein interfaceAnnotated- Returns:
- the type of the annotated program element
-
getTypeClosure
public Set<Type> getTypeClosure()
Description copied from interface:AnnotatedGet all types to which the base type should be considered assignable.
- Specified by:
getTypeClosurein interfaceAnnotated- Returns:
- a set of all types to which the base type should be considered assignable
-
getAnnotations
public Set<Annotation> getAnnotations()
Description copied from interface:AnnotatedGet all annotations of the program element.
- Specified by:
getAnnotationsin interfaceAnnotated- Returns:
- all annotations of the program element, or an empty set if no annotations are present
-
getMetaAnnotations
public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
Description copied from interface:EnhancedAnnotatedGets all annotations which are annotated with the given meta annotation type- Specified by:
getMetaAnnotationsin interfaceEnhancedAnnotated<T,S>- Returns:
- A set of matching meta-annotations. Returns an empty set if there are no matches.
-
getQualifiers
@Deprecated public Set<Annotation> getQualifiers()
Deprecated.Description copied from interface:EnhancedAnnotatedGets the binding types for this element- Specified by:
getQualifiersin interfaceEnhancedAnnotated<T,S>
-
getBindingsAsArray
@Deprecated public Annotation[] getBindingsAsArray()
Deprecated.Description copied from interface:EnhancedAnnotatedGets the binding types for this element- Specified by:
getBindingsAsArrayin interfaceEnhancedAnnotated<T,S>
-
getAnnotation
public <A extends Annotation> A getAnnotation(Class<A> annotationType)
Description copied from interface:AnnotatedGet program element annotation of a certain annotation type. The behavior of this method is intended to be the same behavior as
AnnotatedElement.getAnnotation(Class), where repeatable annotations are not supported.- Specified by:
getAnnotationin interfaceAnnotated- Type Parameters:
A- the type of the annotation- Parameters:
annotationType- the class of the annotation type- Returns:
- the first program element annotation of the given annotation type, or a null value
-
isAnnotationPresent
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
Description copied from interface:AnnotatedDetermine if the program element has an annotation of a certain annotation type. The behavior of this method is similar to
AnnotatedElement.isAnnotationPresent(Class)for the underlying program element.- Specified by:
isAnnotationPresentin interfaceAnnotated- Parameters:
annotationType- the annotation type to check for- Returns:
- true if the program element has an annotation of the given annotation type, or false otherwise
-
-