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:
Annotated,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 protectedEnhancedAnnotatedTypeImpl(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> Scast(Object object)booleanequals(Object obj)Class<? extends T>getAnnotatedClass()Gets the implementing classSet<AnnotatedConstructor<T>>getConstructors()Get the constructors of the type.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<AnnotatedField<? super T>>getFields()Get the fields of the type.Set<AnnotatedMethod<? super T>>getMethods()Get the methods of the type.StringgetName()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)PackagegetPackage()StringgetSimpleName()inthashCode()booleanisAbstract()booleanisAnonymousClass()booleanisDiscovered()booleanisEnum()booleanisEquivalent(Class<?> clazz)Check if this is equivalent to a java classbooleanisFinal()Indicates if the type if finalbooleanisGeneric()booleanisLocalClass()booleanisMemberClass()booleanisPackagePrivate()booleanisPrivate()booleanisPublic()Indicates if this annotated item is publicbooleanisSerializable()booleanisStatic()Indicates if the type is staticstatic <T> EnhancedAnnotatedType<T>of(SlimAnnotatedType<T> annotatedType, ClassTransformer classTransformer)SlimAnnotatedType<T>slim()Returns a lightweight implementation ofAnnotatedTypewith minimal memory footprint.StringtoString()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 totruethe 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:
getDelegatein 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:
getEnhancedFieldsin interfaceEnhancedAnnotatedType<T>- Returns:
- The set of abstracted fields
-
getDeclaredEnhancedFields
public Collection<EnhancedAnnotatedField<?,? super T>> getDeclaredEnhancedFields()
Description copied from interface:EnhancedAnnotatedTypeGets all fields declared on this class only.- Specified by:
getDeclaredEnhancedFieldsin 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:EnhancedAnnotatedTypeGet a field by name- Specified by:
getDeclaredEnhancedFieldin 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:EnhancedAnnotatedTypeGets all fields which are annotated with the given annotation type on this class only.- Specified by:
getDeclaredEnhancedFieldsin 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:EnhancedAnnotatedTypeGet the constructor which matches the argument list provided- Specified by:
getDeclaredEnhancedConstructorin 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:
getEnhancedFieldsin 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:
isLocalClassin interfaceEnhancedAnnotatedType<T>
-
isAnonymousClass
public boolean isAnonymousClass()
- Specified by:
isAnonymousClassin interfaceEnhancedAnnotatedType<T>
-
isMemberClass
public boolean isMemberClass()
- Specified by:
isMemberClassin interfaceEnhancedAnnotatedType<T>
-
isAbstract
public boolean isAbstract()
- Specified by:
isAbstractin interfaceEnhancedAnnotatedType<T>
-
isEnum
public boolean isEnum()
- Specified by:
isEnumin interfaceEnhancedAnnotatedType<T>
-
isSerializable
public boolean isSerializable()
- Specified by:
isSerializablein 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:
getEnhancedMethodsin 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:EnhancedAnnotatedTypeGets all methods annotated with annotationType- Specified by:
getDeclaredEnhancedMethodsin 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:EnhancedAnnotatedTypeGets all constructors- Specified by:
getEnhancedConstructorsin interfaceEnhancedAnnotatedType<T>
-
getEnhancedConstructors
public Collection<EnhancedAnnotatedConstructor<T>> getEnhancedConstructors(Class<? extends Annotation> annotationType)
Gets constructors with given annotation type- Specified by:
getEnhancedConstructorsin 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:EnhancedAnnotatedTypeGets the no-args constructor- Specified by:
getNoArgsEnhancedConstructorin 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:EnhancedAnnotatedTypeGets declared with parameters annotated with annotationType- Specified by:
getDeclaredEnhancedMethodsWithAnnotatedParametersin 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:EnhancedAnnotatedTypeGets all methods on the type including those declared on a superclass ofEnhancedAnnotated.getJavaClass(). Overridden methods are not returned.- Specified by:
getEnhancedMethodsin interfaceEnhancedAnnotatedType<T>- Returns:
- A set of abstracted methods
-
getDeclaredEnhancedMethods
public Collection<EnhancedAnnotatedMethod<?,? super T>> getDeclaredEnhancedMethods()
Description copied from interface:EnhancedAnnotatedTypeGets all methods on the type- Specified by:
getDeclaredEnhancedMethodsin interfaceEnhancedAnnotatedType<T>- Returns:
- A set of abstracted methods
-
getDeclaredEnhancedMethod
public <M> EnhancedAnnotatedMethod<M,?> getDeclaredEnhancedMethod(MethodSignature signature)
Description copied from interface:EnhancedAnnotatedTypeGet a method by name- Specified by:
getDeclaredEnhancedMethodin 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:EnhancedAnnotatedTypeGet a method by name- Specified by:
getEnhancedMethodin 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:
getSimpleNamein interfaceEnhancedAnnotatedType<T>
-
isStatic
public boolean isStatic()
Indicates if the type is static- Specified by:
isStaticin 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:
isFinalin interfaceEnhancedAnnotated<T,Class<T>>- Returns:
- True if final, false otherwise
- See Also:
EnhancedAnnotated.isFinal()
-
isPublic
public boolean isPublic()
Description copied from interface:EnhancedAnnotatedIndicates if this annotated item is public- Specified by:
isPublicin interfaceEnhancedAnnotated<T,Class<T>>- Returns:
- if public, returns true
-
isGeneric
public boolean isGeneric()
- Specified by:
isGenericin interfaceEnhancedAnnotated<T,Class<T>>
-
getName
public String getName()
Gets the name of the type- Specified by:
getNamein 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:
getEnhancedSuperclassin interfaceEnhancedAnnotatedType<T>- Returns:
- The superclass abstraction
-
isEquivalent
public boolean isEquivalent(Class<?> clazz)
Description copied from interface:EnhancedAnnotatedTypeCheck if this is equivalent to a java class- Specified by:
isEquivalentin interfaceEnhancedAnnotatedType<T>- Parameters:
clazz- The Java class- Returns:
- true if equivalent
-
isPrivate
public boolean isPrivate()
- Specified by:
isPrivatein interfaceEnhancedAnnotated<T,Class<T>>
-
isPackagePrivate
public boolean isPackagePrivate()
- Specified by:
isPackagePrivatein interfaceEnhancedAnnotated<T,Class<T>>
-
getPackage
public Package getPackage()
- Specified by:
getPackagein interfaceEnhancedAnnotated<T,Class<T>>
-
asEnhancedSubclass
public <U> EnhancedAnnotatedType<? extends U> asEnhancedSubclass(EnhancedAnnotatedType<U> clazz)
- Specified by:
asEnhancedSubclassin interfaceEnhancedAnnotatedType<T>
-
cast
public <S> S cast(Object object)
- Specified by:
castin interfaceEnhancedAnnotatedType<T>
-
getConstructors
public Set<AnnotatedConstructor<T>> getConstructors()
Description copied from interface:AnnotatedTypeGet the constructors of the type. If an empty set is returned, a default constructor with no parameters will be assumed.
- Specified by:
getConstructorsin interfaceAnnotatedType<T>- Returns:
- the constructors, or an empty set if none are defined
-
getFields
public Set<AnnotatedField<? super T>> getFields()
Description copied from interface:AnnotatedTypeGet the fields of the type.
- Specified by:
getFieldsin interfaceAnnotatedType<T>- Returns:
- the fields, or an empty set if none are defined
-
getMethods
public Set<AnnotatedMethod<? super T>> getMethods()
Description copied from interface:AnnotatedTypeGet the methods of the type.
- Specified by:
getMethodsin interfaceAnnotatedType<T>- Returns:
- the methods, or an empty set if none are defined
-
getDeclaredMetaAnnotations
public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
Description copied from interface:EnhancedAnnotatedTypeGets all annotations which are declared on this annotated item with the given meta annotation type- Specified by:
getDeclaredMetaAnnotationsin interfaceEnhancedAnnotatedType<T>- Returns:
- A set of matching meta-annotations. Returns an empty set if there are no matches.
-
isDiscovered
public boolean isDiscovered()
- Specified by:
isDiscoveredin interfaceEnhancedAnnotatedType<T>
-
slim
public SlimAnnotatedType<T> slim()
Description copied from interface:EnhancedAnnotatedTypeReturns a lightweight implementation ofAnnotatedTypewith minimal memory footprint.- Specified by:
slimin interfaceEnhancedAnnotated<T,Class<T>>- Specified by:
slimin interfaceEnhancedAnnotatedType<T>- Returns:
- the slim version of this
AnnotatedType
-
getEnhancedMethodsWithAnnotatedParameters
public Collection<EnhancedAnnotatedMethod<?,? super T>> getEnhancedMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
Description copied from interface:EnhancedAnnotatedTypeGets all methods with parameters annotated with annotationType including those declared on a superclass ofEnhancedAnnotated.getJavaClass(). Overridden methods are not returned.- Specified by:
getEnhancedMethodsWithAnnotatedParametersin 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
-
-