Class EnhancedAnnotatedTypeImpl<T>
- java.lang.Object
-
- org.jboss.weld.annotated.enhanced.jlr.AbstractEnhancedAnnotated<T,Class<T>>
-
- org.jboss.weld.annotated.enhanced.jlr.EnhancedAnnotatedTypeImpl<T>
-
- Type Parameters:
T
- the type of the class
- All Implemented Interfaces:
javax.enterprise.inject.spi.Annotated
,javax.enterprise.inject.spi.AnnotatedType<T>
,EnhancedAnnotated<T,Class<T>>
,EnhancedAnnotatedType<T>
- Direct Known Subclasses:
EnhancedAnnotationImpl
public class EnhancedAnnotatedTypeImpl<T> extends AbstractEnhancedAnnotated<T,Class<T>> implements EnhancedAnnotatedType<T>
Represents an annotated class This class is immutable, and therefore threadsafe- Author:
- Pete Muir, David Allen, Ales Justin
-
-
Field Summary
-
Fields inherited from interface org.jboss.weld.annotated.enhanced.EnhancedAnnotated
MAPPED_DECLARED_METAANNOTATIONS, MAPPED_METAANNOTATIONS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EnhancedAnnotatedTypeImpl(SlimAnnotatedType<T> annotatedType, Map<Class<? extends Annotation>,Annotation> annotationMap, Map<Class<? extends Annotation>,Annotation> declaredAnnotationMap, ClassTransformer classTransformer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <U> EnhancedAnnotatedType<? extends U>
asEnhancedSubclass(EnhancedAnnotatedType<U> clazz)
protected Multimap<Class<? extends Annotation>,EnhancedAnnotatedMethod<?,? super T>>
buildAnnotatedMethodMultimap(Set<EnhancedAnnotatedMethod<?,? super T>> effectiveMethods)
protected Multimap<Class<? extends Annotation>,EnhancedAnnotatedMethod<?,? super T>>
buildAnnotatedParameterMethodMultimap(Set<EnhancedAnnotatedMethod<?,? super T>> effectiveMethods)
<S> S
cast(Object object)
boolean
equals(Object obj)
Class<? extends T>
getAnnotatedClass()
Gets the implementing classSet<javax.enterprise.inject.spi.AnnotatedConstructor<T>>
getConstructors()
EnhancedAnnotatedConstructor<T>
getDeclaredEnhancedConstructor(ConstructorSignature signature)
Get the constructor which matches the argument list provided<F> EnhancedAnnotatedField<F,?>
getDeclaredEnhancedField(String fieldName)
Get a field by nameCollection<EnhancedAnnotatedField<?,? super T>>
getDeclaredEnhancedFields()
Gets all fields declared on this class only.Collection<EnhancedAnnotatedField<?,? super T>>
getDeclaredEnhancedFields(Class<? extends Annotation> annotationType)
Gets all fields which are annotated with the given annotation type on this class only.<M> EnhancedAnnotatedMethod<M,?>
getDeclaredEnhancedMethod(MethodSignature signature)
Get a method by nameCollection<EnhancedAnnotatedMethod<?,? super T>>
getDeclaredEnhancedMethods()
Gets all methods on the typeCollection<EnhancedAnnotatedMethod<?,? super T>>
getDeclaredEnhancedMethods(Class<? extends Annotation> annotationType)
Gets all methods annotated with annotationTypeCollection<EnhancedAnnotatedMethod<?,? super T>>
getDeclaredEnhancedMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
Gets declared with parameters annotated with annotationTypeSet<Annotation>
getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
Gets all annotations which are declared on this annotated item with the given meta annotation typeClass<T>
getDelegate()
Gets the delegate (class)Collection<EnhancedAnnotatedConstructor<T>>
getEnhancedConstructors()
Gets all constructorsCollection<EnhancedAnnotatedConstructor<T>>
getEnhancedConstructors(Class<? extends Annotation> annotationType)
Gets constructors with given annotation typeCollection<EnhancedAnnotatedField<?,? super T>>
getEnhancedFields()
Gets the abstracted fields of the classCollection<EnhancedAnnotatedField<?,?>>
getEnhancedFields(Class<? extends Annotation> annotationType)
Gets the abstracted field annotated with a specific annotation type<M> EnhancedAnnotatedMethod<M,?>
getEnhancedMethod(MethodSignature signature)
Get a method by nameCollection<EnhancedAnnotatedMethod<?,? super T>>
getEnhancedMethods()
Gets all methods on the type including those declared on a superclass ofEnhancedAnnotated.getJavaClass()
.Collection<EnhancedAnnotatedMethod<?,? super T>>
getEnhancedMethods(Class<? extends Annotation> annotationType)
Gets the abstracted methods that have a certain annotation type presentCollection<EnhancedAnnotatedMethod<?,? super T>>
getEnhancedMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
Gets all methods with parameters annotated with annotationType including those declared on a superclass ofEnhancedAnnotated.getJavaClass()
.EnhancedAnnotatedType<? super T>
getEnhancedSuperclass()
Gets the superclass abstraction of the typeSet<javax.enterprise.inject.spi.AnnotatedField<? super T>>
getFields()
Set<javax.enterprise.inject.spi.AnnotatedMethod<? super T>>
getMethods()
String
getName()
Gets the name of the typeEnhancedAnnotatedConstructor<T>
getNoArgsEnhancedConstructor()
Gets the no-args constructorprotected Set<EnhancedAnnotatedMethod<?,? super T>>
getOverriddenMethods(EnhancedAnnotatedType<T> annotatedType, Set<EnhancedAnnotatedMethod<?,? super T>> methods)
protected Set<EnhancedAnnotatedMethod<?,? super T>>
getOverriddenMethods(EnhancedAnnotatedType<T> annotatedType, Set<EnhancedAnnotatedMethod<?,? super T>> methods, boolean skipOverridingBridgeMethods)
Package
getPackage()
String
getSimpleName()
int
hashCode()
boolean
isAbstract()
boolean
isAnonymousClass()
boolean
isDiscovered()
boolean
isEnum()
boolean
isEquivalent(Class<?> clazz)
Check if this is equivalent to a java classboolean
isFinal()
Indicates if the type if finalboolean
isGeneric()
boolean
isLocalClass()
boolean
isMemberClass()
boolean
isPackagePrivate()
boolean
isPrivate()
boolean
isPublic()
Indicates if this annotated item is publicboolean
isSerializable()
boolean
isStatic()
Indicates if the type is staticstatic <T> EnhancedAnnotatedType<T>
of(SlimAnnotatedType<T> annotatedType, ClassTransformer classTransformer)
SlimAnnotatedType<T>
slim()
Returns a lightweight implementation ofAnnotatedType
with minimal memory footprint.String
toString()
Gets a string representation of the class-
Methods inherited from class org.jboss.weld.annotated.enhanced.jlr.AbstractEnhancedAnnotated
addMetaAnnotations, buildAnnotationMap, getActualTypeArguments, getAnnotation, getAnnotations, getBaseType, getBindingsAsArray, getInterfaceClosure, getJavaClass, getMetaAnnotations, getQualifiers, getTypeClosure, isAnnotationPresent, isParameterizedType, isPrimitive, processMetaAnnotations, processMetaAnnotations, processMetaAnnotations
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.enterprise.inject.spi.Annotated
getAnnotation, getAnnotations, getBaseType, getTypeClosure, isAnnotationPresent
-
Methods inherited from interface javax.enterprise.inject.spi.AnnotatedType
getAnnotations, getJavaClass
-
Methods inherited from interface org.jboss.weld.annotated.enhanced.EnhancedAnnotated
getActualTypeArguments, getBindingsAsArray, getInterfaceClosure, getJavaClass, getMetaAnnotations, getQualifiers, isPrimitive
-
Methods inherited from interface org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType
isParameterizedType
-
-
-
-
Constructor Detail
-
EnhancedAnnotatedTypeImpl
protected EnhancedAnnotatedTypeImpl(SlimAnnotatedType<T> annotatedType, Map<Class<? extends Annotation>,Annotation> annotationMap, Map<Class<? extends Annotation>,Annotation> declaredAnnotationMap, ClassTransformer classTransformer)
-
-
Method Detail
-
of
public static <T> EnhancedAnnotatedType<T> of(SlimAnnotatedType<T> annotatedType, ClassTransformer classTransformer)
-
getOverriddenMethods
protected Set<EnhancedAnnotatedMethod<?,? super T>> getOverriddenMethods(EnhancedAnnotatedType<T> annotatedType, Set<EnhancedAnnotatedMethod<?,? super T>> methods)
-
getOverriddenMethods
protected Set<EnhancedAnnotatedMethod<?,? super T>> getOverriddenMethods(EnhancedAnnotatedType<T> annotatedType, Set<EnhancedAnnotatedMethod<?,? super T>> methods, boolean skipOverridingBridgeMethods)
- Parameters:
annotatedType
-methods
-skipOverridingBridgeMethods
- If set totrue
the returning set will not contain methods overriden by a bridge method- Returns:
- the set of overriden methods
-
buildAnnotatedMethodMultimap
protected Multimap<Class<? extends Annotation>,EnhancedAnnotatedMethod<?,? super T>> buildAnnotatedMethodMultimap(Set<EnhancedAnnotatedMethod<?,? super T>> effectiveMethods)
-
buildAnnotatedParameterMethodMultimap
protected Multimap<Class<? extends Annotation>,EnhancedAnnotatedMethod<?,? super T>> buildAnnotatedParameterMethodMultimap(Set<EnhancedAnnotatedMethod<?,? super T>> effectiveMethods)
-
getAnnotatedClass
public Class<? extends T> getAnnotatedClass()
Gets the implementing class- Returns:
- The class
-
getDelegate
public Class<T> getDelegate()
Gets the delegate (class)- Specified by:
getDelegate
in classAbstractEnhancedAnnotated<T,Class<T>>
- Returns:
- The class
-
getEnhancedFields
public Collection<EnhancedAnnotatedField<?,? super T>> getEnhancedFields()
Gets the abstracted fields of the class Initializes the fields if they are null- Specified by:
getEnhancedFields
in interfaceEnhancedAnnotatedType<T>
- Returns:
- The set of abstracted fields
-
getDeclaredEnhancedFields
public Collection<EnhancedAnnotatedField<?,? super T>> getDeclaredEnhancedFields()
Description copied from interface:EnhancedAnnotatedType
Gets all fields declared on this class only.- Specified by:
getDeclaredEnhancedFields
in interfaceEnhancedAnnotatedType<T>
- Returns:
- A set of abstracted fields. Returns an empty set if there are no matches
-
getDeclaredEnhancedField
public <F> EnhancedAnnotatedField<F,?> getDeclaredEnhancedField(String fieldName)
Description copied from interface:EnhancedAnnotatedType
Get a field by name- Specified by:
getDeclaredEnhancedField
in interfaceEnhancedAnnotatedType<T>
- Type Parameters:
F
- the expected type of the field- Parameters:
fieldName
- the field name- Returns:
- the field
-
getDeclaredEnhancedFields
public Collection<EnhancedAnnotatedField<?,? super T>> getDeclaredEnhancedFields(Class<? extends Annotation> annotationType)
Description copied from interface:EnhancedAnnotatedType
Gets all fields which are annotated with the given annotation type on this class only.- Specified by:
getDeclaredEnhancedFields
in interfaceEnhancedAnnotatedType<T>
- Parameters:
annotationType
- The annotation to match- Returns:
- A set of abstracted fields with the given annotation. Returns an empty set if there are no matches
-
getDeclaredEnhancedConstructor
public EnhancedAnnotatedConstructor<T> getDeclaredEnhancedConstructor(ConstructorSignature signature)
Description copied from interface:EnhancedAnnotatedType
Get the constructor which matches the argument list provided- Specified by:
getDeclaredEnhancedConstructor
in interfaceEnhancedAnnotatedType<T>
- Returns:
- the matching constructor, or null if not defined
-
getEnhancedFields
public Collection<EnhancedAnnotatedField<?,?>> getEnhancedFields(Class<? extends Annotation> annotationType)
Gets the abstracted field annotated with a specific annotation type If the fields map is null, initialize it first- Specified by:
getEnhancedFields
in interfaceEnhancedAnnotatedType<T>
- Parameters:
annotationType
- The annotation type to match- Returns:
- A set of matching abstracted fields, null if none are found.
-
isLocalClass
public boolean isLocalClass()
- Specified by:
isLocalClass
in interfaceEnhancedAnnotatedType<T>
-
isAnonymousClass
public boolean isAnonymousClass()
- Specified by:
isAnonymousClass
in interfaceEnhancedAnnotatedType<T>
-
isMemberClass
public boolean isMemberClass()
- Specified by:
isMemberClass
in interfaceEnhancedAnnotatedType<T>
-
isAbstract
public boolean isAbstract()
- Specified by:
isAbstract
in interfaceEnhancedAnnotatedType<T>
-
isEnum
public boolean isEnum()
- Specified by:
isEnum
in interfaceEnhancedAnnotatedType<T>
-
isSerializable
public boolean isSerializable()
- Specified by:
isSerializable
in interfaceEnhancedAnnotatedType<T>
-
getEnhancedMethods
public Collection<EnhancedAnnotatedMethod<?,? super T>> getEnhancedMethods(Class<? extends Annotation> annotationType)
Gets the abstracted methods that have a certain annotation type present If the annotated methods map is null, initialize it first- Specified by:
getEnhancedMethods
in interfaceEnhancedAnnotatedType<T>
- Parameters:
annotationType
- The annotation type to match- Returns:
- A set of matching method abstractions. Returns an empty set if no matches are found.
- See Also:
EnhancedAnnotatedType.getEnhancedMethods(Class)
-
getDeclaredEnhancedMethods
public Collection<EnhancedAnnotatedMethod<?,? super T>> getDeclaredEnhancedMethods(Class<? extends Annotation> annotationType)
Description copied from interface:EnhancedAnnotatedType
Gets all methods annotated with annotationType- Specified by:
getDeclaredEnhancedMethods
in interfaceEnhancedAnnotatedType<T>
- Parameters:
annotationType
- The annotation to match- Returns:
- A set of abstracted methods with the given annotation. Returns an empty set if there are no matches
-
getEnhancedConstructors
public Collection<EnhancedAnnotatedConstructor<T>> getEnhancedConstructors()
Description copied from interface:EnhancedAnnotatedType
Gets all constructors- Specified by:
getEnhancedConstructors
in interfaceEnhancedAnnotatedType<T>
-
getEnhancedConstructors
public Collection<EnhancedAnnotatedConstructor<T>> getEnhancedConstructors(Class<? extends Annotation> annotationType)
Gets constructors with given annotation type- Specified by:
getEnhancedConstructors
in interfaceEnhancedAnnotatedType<T>
- Parameters:
annotationType
- The annotation type to match- Returns:
- A set of abstracted constructors with given annotation type. If the constructors set is empty, initialize it first. Returns an empty set if there are no matches.
- See Also:
EnhancedAnnotatedType.getEnhancedConstructors(Class)
-
getNoArgsEnhancedConstructor
public EnhancedAnnotatedConstructor<T> getNoArgsEnhancedConstructor()
Description copied from interface:EnhancedAnnotatedType
Gets the no-args constructor- Specified by:
getNoArgsEnhancedConstructor
in interfaceEnhancedAnnotatedType<T>
- Returns:
- The no-args constructor, or null if not defined
-
getDeclaredEnhancedMethodsWithAnnotatedParameters
public Collection<EnhancedAnnotatedMethod<?,? super T>> getDeclaredEnhancedMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
Description copied from interface:EnhancedAnnotatedType
Gets declared with parameters annotated with annotationType- Specified by:
getDeclaredEnhancedMethodsWithAnnotatedParameters
in interfaceEnhancedAnnotatedType<T>
- Parameters:
annotationType
- The annotation to match- Returns:
- A set of abstracted methods with the given annotation. Returns an empty set if there are no matches
-
getEnhancedMethods
public Collection<EnhancedAnnotatedMethod<?,? super T>> getEnhancedMethods()
Description copied from interface:EnhancedAnnotatedType
Gets all methods on the type including those declared on a superclass ofEnhancedAnnotated.getJavaClass()
. Overridden methods are not returned.- Specified by:
getEnhancedMethods
in interfaceEnhancedAnnotatedType<T>
- Returns:
- A set of abstracted methods
-
getDeclaredEnhancedMethods
public Collection<EnhancedAnnotatedMethod<?,? super T>> getDeclaredEnhancedMethods()
Description copied from interface:EnhancedAnnotatedType
Gets all methods on the type- Specified by:
getDeclaredEnhancedMethods
in interfaceEnhancedAnnotatedType<T>
- Returns:
- A set of abstracted methods
-
getDeclaredEnhancedMethod
public <M> EnhancedAnnotatedMethod<M,?> getDeclaredEnhancedMethod(MethodSignature signature)
Description copied from interface:EnhancedAnnotatedType
Get a method by name- Specified by:
getDeclaredEnhancedMethod
in interfaceEnhancedAnnotatedType<T>
- Type Parameters:
M
- the expected return type- Parameters:
signature
- the name of the method- Returns:
- the method, or null if it doesn't exist
-
getEnhancedMethod
public <M> EnhancedAnnotatedMethod<M,?> getEnhancedMethod(MethodSignature signature)
Description copied from interface:EnhancedAnnotatedType
Get a method by name- Specified by:
getEnhancedMethod
in interfaceEnhancedAnnotatedType<T>
- Type Parameters:
M
- the expected return type- Parameters:
signature
- the name of the method- Returns:
- the method, or null if it doesn't exist
-
toString
public String toString()
Gets a string representation of the class
-
getSimpleName
public String getSimpleName()
- Specified by:
getSimpleName
in interfaceEnhancedAnnotatedType<T>
-
isStatic
public boolean isStatic()
Indicates if the type is static- Specified by:
isStatic
in interfaceEnhancedAnnotated<T,Class<T>>
- Returns:
- True if static, false otherwise
- See Also:
EnhancedAnnotated.isStatic()
-
isFinal
public boolean isFinal()
Indicates if the type if final- Specified by:
isFinal
in interfaceEnhancedAnnotated<T,Class<T>>
- Returns:
- True if final, false otherwise
- See Also:
EnhancedAnnotated.isFinal()
-
isPublic
public boolean isPublic()
Description copied from interface:EnhancedAnnotated
Indicates if this annotated item is public- Specified by:
isPublic
in interfaceEnhancedAnnotated<T,Class<T>>
- Returns:
- if public, returns true
-
isGeneric
public boolean isGeneric()
- Specified by:
isGeneric
in interfaceEnhancedAnnotated<T,Class<T>>
-
getName
public String getName()
Gets the name of the type- Specified by:
getName
in interfaceEnhancedAnnotated<T,Class<T>>
- Returns:
- The name
- See Also:
EnhancedAnnotated.getName()
-
getEnhancedSuperclass
public EnhancedAnnotatedType<? super T> getEnhancedSuperclass()
Gets the superclass abstraction of the type- Specified by:
getEnhancedSuperclass
in interfaceEnhancedAnnotatedType<T>
- Returns:
- The superclass abstraction
-
isEquivalent
public boolean isEquivalent(Class<?> clazz)
Description copied from interface:EnhancedAnnotatedType
Check if this is equivalent to a java class- Specified by:
isEquivalent
in interfaceEnhancedAnnotatedType<T>
- Parameters:
clazz
- The Java class- Returns:
- true if equivalent
-
isPrivate
public boolean isPrivate()
- Specified by:
isPrivate
in interfaceEnhancedAnnotated<T,Class<T>>
-
isPackagePrivate
public boolean isPackagePrivate()
- Specified by:
isPackagePrivate
in interfaceEnhancedAnnotated<T,Class<T>>
-
getPackage
public Package getPackage()
- Specified by:
getPackage
in interfaceEnhancedAnnotated<T,Class<T>>
-
asEnhancedSubclass
public <U> EnhancedAnnotatedType<? extends U> asEnhancedSubclass(EnhancedAnnotatedType<U> clazz)
- Specified by:
asEnhancedSubclass
in interfaceEnhancedAnnotatedType<T>
-
cast
public <S> S cast(Object object)
- Specified by:
cast
in interfaceEnhancedAnnotatedType<T>
-
getConstructors
public Set<javax.enterprise.inject.spi.AnnotatedConstructor<T>> getConstructors()
- Specified by:
getConstructors
in interfacejavax.enterprise.inject.spi.AnnotatedType<T>
-
getFields
public Set<javax.enterprise.inject.spi.AnnotatedField<? super T>> getFields()
- Specified by:
getFields
in interfacejavax.enterprise.inject.spi.AnnotatedType<T>
-
getMethods
public Set<javax.enterprise.inject.spi.AnnotatedMethod<? super T>> getMethods()
- Specified by:
getMethods
in interfacejavax.enterprise.inject.spi.AnnotatedType<T>
-
getDeclaredMetaAnnotations
public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
Description copied from interface:EnhancedAnnotatedType
Gets all annotations which are declared on this annotated item with the given meta annotation type- Specified by:
getDeclaredMetaAnnotations
in interfaceEnhancedAnnotatedType<T>
- Returns:
- A set of matching meta-annotations. Returns an empty set if there are no matches.
-
isDiscovered
public boolean isDiscovered()
- Specified by:
isDiscovered
in interfaceEnhancedAnnotatedType<T>
-
slim
public SlimAnnotatedType<T> slim()
Description copied from interface:EnhancedAnnotatedType
Returns a lightweight implementation ofAnnotatedType
with minimal memory footprint.- Specified by:
slim
in interfaceEnhancedAnnotated<T,Class<T>>
- Specified by:
slim
in interfaceEnhancedAnnotatedType<T>
- Returns:
- the slim version of this
AnnotatedType
-
getEnhancedMethodsWithAnnotatedParameters
public Collection<EnhancedAnnotatedMethod<?,? super T>> getEnhancedMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
Description copied from interface:EnhancedAnnotatedType
Gets all methods with parameters annotated with annotationType including those declared on a superclass ofEnhancedAnnotated.getJavaClass()
. Overridden methods are not returned.- Specified by:
getEnhancedMethodsWithAnnotatedParameters
in interfaceEnhancedAnnotatedType<T>
- Parameters:
annotationType
- The annotation to match- Returns:
- A set of abstracted methods with the given annotation. Returns an empty set if there are no matches
-
-