org.jboss.weld.introspector.jlr
Class WeldClassImpl<T>

java.lang.Object
  extended by org.jboss.weld.introspector.jlr.AbstractWeldAnnotated<T,Class<T>>
      extended by org.jboss.weld.introspector.jlr.WeldClassImpl<T>
Type Parameters:
T - the type of the class
All Implemented Interfaces:
javax.enterprise.inject.spi.Annotated, javax.enterprise.inject.spi.AnnotatedType<T>, WeldAnnotated<T,Class<T>>, WeldClass<T>
Direct Known Subclasses:
WeldAnnotationImpl

public class WeldClassImpl<T>
extends AbstractWeldAnnotated<T,Class<T>>
implements WeldClass<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.introspector.WeldAnnotated
MAPPED_DECLARED_METAANNOTATIONS, MAPPED_METAANNOTATIONS
 
Constructor Summary
protected WeldClassImpl(Class<T> rawType, Type type, javax.enterprise.inject.spi.AnnotatedType<T> annotatedType, LazyValueHolder<Set<Type>> typeClosure, Map<Class<? extends Annotation>,Annotation> annotationMap, Map<Class<? extends Annotation>,Annotation> declaredAnnotationMap, ClassTransformer classTransformer)
           
 
Method Summary
<U> WeldClass<? extends U>
asWeldSubclass(WeldClass<U> clazz)
           
<S> S
cast(Object object)
           
 Class<? extends T> getAnnotatedClass()
          Gets the implementing class
 Set<javax.enterprise.inject.spi.AnnotatedConstructor<T>> getConstructors()
           
 Collection<WeldField<?,?>> getDeclaredFields()
           
 Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
          Gets all annotations which are declared on this annotated item with the given meta annotation type
 WeldConstructor<T> getDeclaredWeldConstructor(ConstructorSignature signature)
          Get the constructor which matches the argument list provided
<F> WeldField<F,?>
getDeclaredWeldField(String fieldName)
          Get a field by name
 Collection<WeldField<?,? super T>> getDeclaredWeldFields(Class<? extends Annotation> annotationType)
          Gets all fields which are annotated with the given annotation type on this class only.
 WeldMethod<?,?> getDeclaredWeldMethod(Method method)
           
<M> WeldMethod<M,?>
getDeclaredWeldMethod(MethodSignature signature)
          Get a method by name
 Collection<WeldMethod<?,? super T>> getDeclaredWeldMethods()
          Gets all fields on the type
 Collection<WeldMethod<?,? super T>> getDeclaredWeldMethods(Class<? extends Annotation> annotationType)
          Gets all methods annotated with annotationType
 Collection<WeldMethod<?,? super T>> getDeclaredWeldMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
          Gets declared with parameters annotated with annotationType
 Class<T> getDelegate()
          Gets the delegate (class)
 Set<javax.enterprise.inject.spi.AnnotatedField<? super T>> getFields()
           
 Set<javax.enterprise.inject.spi.AnnotatedMethod<? super T>> getMethods()
           
 String getName()
          Gets the name of the type
 WeldConstructor<T> getNoArgsWeldConstructor()
          Gets the no-args constructor
 Package getPackage()
           
 String getSimpleName()
           
 Collection<WeldConstructor<T>> getWeldConstructors(Class<? extends Annotation> annotationType)
          Gets constructors with given annotation type
 Collection<WeldField<?,?>> getWeldFields()
          Gets the abstracted fields of the class

Initializes the fields if they are null

 Collection<WeldField<?,?>> getWeldFields(Class<? extends Annotation> annotationType)
          Gets the abstracted field annotated with a specific annotation type

If the fields map is null, initialize it first

 WeldMethod<?,?> getWeldMethod(Method methodDescriptor)
          Find the annotated method for a given methodDescriptor
<M> WeldMethod<M,?>
getWeldMethod(MethodSignature signature)
          Get a method by name
 Collection<WeldMethod<?,? super T>> getWeldMethods()
          Gets all fields on the type
 Collection<WeldMethod<?,?>> getWeldMethods(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

 WeldClass<? super T> getWeldSuperclass()
          Gets the superclass abstraction of the type
 boolean isAbstract()
           
 boolean isAnonymousClass()
           
 boolean isDiscovered()
           
 boolean isEnum()
           
 boolean isEquivalent(Class<?> clazz)
          Check if this is equivalent to a java class
 boolean isFinal()
          Indicates if the type if final
 boolean isGeneric()
           
 boolean isLocalClass()
           
 boolean isMemberClass()
           
 boolean isPackagePrivate()
           
 boolean isPrivate()
           
 boolean isPublic()
          Indicates if this annotated item is public
 boolean isSerializable()
           
 boolean isStatic()
          Indicates if the type is static
static
<T> WeldClass<T>
of(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType, ClassTransformer classTransformer)
           
static
<T> WeldClass<T>
of(Class<T> clazz, ClassTransformer classTransformer)
           
static
<T> WeldClass<T>
of(Class<T> rawType, Type type, ClassTransformer classTransformer)
           
 String toString()
          Gets a string representation of the class
 
Methods inherited from class org.jboss.weld.introspector.jlr.AbstractWeldAnnotated
addMetaAnnotations, addMetaAnnotations, buildAnnotationMap, buildAnnotationMap, getActualTypeArguments, getAnnotation, getAnnotations, getBaseType, getBindingsAsArray, getInterfaceClosure, getJavaClass, getMetaAnnotations, getQualifiers, getTypeClosure, isAnnotationPresent, isParameterizedType, isPrimitive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.weld.introspector.WeldClass
isParameterizedType
 
Methods inherited from interface org.jboss.weld.introspector.WeldAnnotated
getActualTypeArguments, getBindingsAsArray, getInterfaceClosure, getJavaClass, getMetaAnnotations, getQualifiers, isPrimitive
 
Methods inherited from interface javax.enterprise.inject.spi.AnnotatedType
getJavaClass
 
Methods inherited from interface javax.enterprise.inject.spi.Annotated
getAnnotation, getAnnotations, getBaseType, getTypeClosure, isAnnotationPresent
 

Constructor Detail

WeldClassImpl

protected WeldClassImpl(Class<T> rawType,
                        Type type,
                        javax.enterprise.inject.spi.AnnotatedType<T> annotatedType,
                        LazyValueHolder<Set<Type>> typeClosure,
                        Map<Class<? extends Annotation>,Annotation> annotationMap,
                        Map<Class<? extends Annotation>,Annotation> declaredAnnotationMap,
                        ClassTransformer classTransformer)
Method Detail

of

public static <T> WeldClass<T> of(Class<T> clazz,
                                  ClassTransformer classTransformer)

of

public static <T> WeldClass<T> of(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType,
                                  ClassTransformer classTransformer)

of

public static <T> WeldClass<T> of(Class<T> rawType,
                                  Type type,
                                  ClassTransformer classTransformer)

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 class AbstractWeldAnnotated<T,Class<T>>
Returns:
The class

getWeldFields

public Collection<WeldField<?,?>> getWeldFields()
Gets the abstracted fields of the class

Initializes the fields if they are null

Specified by:
getWeldFields in interface WeldClass<T>
Returns:
The set of abstracted fields

getDeclaredFields

public Collection<WeldField<?,?>> getDeclaredFields()

getDeclaredWeldField

public <F> WeldField<F,?> getDeclaredWeldField(String fieldName)
Description copied from interface: WeldClass
Get a field by name

Specified by:
getDeclaredWeldField in interface WeldClass<T>
Type Parameters:
F - the expected type of the field
Parameters:
fieldName - the field name
Returns:
the field

getDeclaredWeldFields

public Collection<WeldField<?,? super T>> getDeclaredWeldFields(Class<? extends Annotation> annotationType)
Description copied from interface: WeldClass
Gets all fields which are annotated with the given annotation type on this class only.

Specified by:
getDeclaredWeldFields in interface WeldClass<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

getDeclaredWeldConstructor

public WeldConstructor<T> getDeclaredWeldConstructor(ConstructorSignature signature)
Description copied from interface: WeldClass
Get the constructor which matches the argument list provided

Specified by:
getDeclaredWeldConstructor in interface WeldClass<T>
Returns:
the matching constructor, or null if not defined

getWeldFields

public Collection<WeldField<?,?>> getWeldFields(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:
getWeldFields in interface WeldClass<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 interface WeldClass<T>

isAnonymousClass

public boolean isAnonymousClass()
Specified by:
isAnonymousClass in interface WeldClass<T>

isMemberClass

public boolean isMemberClass()
Specified by:
isMemberClass in interface WeldClass<T>

isAbstract

public boolean isAbstract()
Specified by:
isAbstract in interface WeldClass<T>

isEnum

public boolean isEnum()
Specified by:
isEnum in interface WeldClass<T>

isSerializable

public boolean isSerializable()
Specified by:
isSerializable in interface WeldClass<T>

getWeldMethods

public Collection<WeldMethod<?,?>> getWeldMethods(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:
getWeldMethods in interface WeldClass<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:
WeldClass.getWeldMethods(Class)

getDeclaredWeldMethods

public Collection<WeldMethod<?,? super T>> getDeclaredWeldMethods(Class<? extends Annotation> annotationType)
Description copied from interface: WeldClass
Gets all methods annotated with annotationType

Specified by:
getDeclaredWeldMethods in interface WeldClass<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

getWeldConstructors

public Collection<WeldConstructor<T>> getWeldConstructors(Class<? extends Annotation> annotationType)
Gets constructors with given annotation type

Specified by:
getWeldConstructors in interface WeldClass<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:
WeldClass.getWeldConstructors(Class)

getNoArgsWeldConstructor

public WeldConstructor<T> getNoArgsWeldConstructor()
Description copied from interface: WeldClass
Gets the no-args constructor

Specified by:
getNoArgsWeldConstructor in interface WeldClass<T>
Returns:
The no-args constructor, or null if not defined

getDeclaredWeldMethodsWithAnnotatedParameters

public Collection<WeldMethod<?,? super T>> getDeclaredWeldMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
Description copied from interface: WeldClass
Gets declared with parameters annotated with annotationType

Specified by:
getDeclaredWeldMethodsWithAnnotatedParameters in interface WeldClass<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

getWeldMethod

public WeldMethod<?,?> getWeldMethod(Method methodDescriptor)
Description copied from interface: WeldClass
Find the annotated method for a given methodDescriptor

Specified by:
getWeldMethod in interface WeldClass<T>
Returns:

getWeldMethods

public Collection<WeldMethod<?,? super T>> getWeldMethods()
Description copied from interface: WeldClass
Gets all fields on the type

Specified by:
getWeldMethods in interface WeldClass<T>
Returns:
A set of abstracted fields

getDeclaredWeldMethod

public WeldMethod<?,?> getDeclaredWeldMethod(Method method)
Specified by:
getDeclaredWeldMethod in interface WeldClass<T>

getDeclaredWeldMethods

public Collection<WeldMethod<?,? super T>> getDeclaredWeldMethods()
Description copied from interface: WeldClass
Gets all fields on the type

Specified by:
getDeclaredWeldMethods in interface WeldClass<T>
Returns:
A set of abstracted fields

getDeclaredWeldMethod

public <M> WeldMethod<M,?> getDeclaredWeldMethod(MethodSignature signature)
Description copied from interface: WeldClass
Get a method by name

Specified by:
getDeclaredWeldMethod in interface WeldClass<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

getWeldMethod

public <M> WeldMethod<M,?> getWeldMethod(MethodSignature signature)
Description copied from interface: WeldClass
Get a method by name

Specified by:
getWeldMethod in interface WeldClass<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

Overrides:
toString in class Object
Returns:
A string representation

getSimpleName

public String getSimpleName()
Specified by:
getSimpleName in interface WeldClass<T>

isStatic

public boolean isStatic()
Indicates if the type is static

Specified by:
isStatic in interface WeldAnnotated<T,Class<T>>
Returns:
True if static, false otherwise
See Also:
WeldAnnotated.isStatic()

isFinal

public boolean isFinal()
Indicates if the type if final

Specified by:
isFinal in interface WeldAnnotated<T,Class<T>>
Returns:
True if final, false otherwise
See Also:
WeldAnnotated.isFinal()

isPublic

public boolean isPublic()
Description copied from interface: WeldAnnotated
Indicates if this annotated item is public

Specified by:
isPublic in interface WeldAnnotated<T,Class<T>>
Returns:
if public, returns true

isGeneric

public boolean isGeneric()
Specified by:
isGeneric in interface WeldAnnotated<T,Class<T>>

getName

public String getName()
Gets the name of the type

Specified by:
getName in interface WeldAnnotated<T,Class<T>>
Returns:
The name
See Also:
WeldAnnotated.getName()

getWeldSuperclass

public WeldClass<? super T> getWeldSuperclass()
Gets the superclass abstraction of the type

Specified by:
getWeldSuperclass in interface WeldClass<T>
Returns:
The superclass abstraction

isEquivalent

public boolean isEquivalent(Class<?> clazz)
Description copied from interface: WeldClass
Check if this is equivalent to a java class

Specified by:
isEquivalent in interface WeldClass<T>
Parameters:
clazz - The Java class
Returns:
true if equivalent

isPrivate

public boolean isPrivate()
Specified by:
isPrivate in interface WeldAnnotated<T,Class<T>>

isPackagePrivate

public boolean isPackagePrivate()
Specified by:
isPackagePrivate in interface WeldAnnotated<T,Class<T>>

getPackage

public Package getPackage()
Specified by:
getPackage in interface WeldAnnotated<T,Class<T>>

asWeldSubclass

public <U> WeldClass<? extends U> asWeldSubclass(WeldClass<U> clazz)
Specified by:
asWeldSubclass in interface WeldClass<T>

cast

public <S> S cast(Object object)
Specified by:
cast in interface WeldClass<T>

getConstructors

public Set<javax.enterprise.inject.spi.AnnotatedConstructor<T>> getConstructors()
Specified by:
getConstructors in interface javax.enterprise.inject.spi.AnnotatedType<T>

getFields

public Set<javax.enterprise.inject.spi.AnnotatedField<? super T>> getFields()
Specified by:
getFields in interface javax.enterprise.inject.spi.AnnotatedType<T>

getMethods

public Set<javax.enterprise.inject.spi.AnnotatedMethod<? super T>> getMethods()
Specified by:
getMethods in interface javax.enterprise.inject.spi.AnnotatedType<T>

getDeclaredMetaAnnotations

public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
Description copied from interface: WeldClass
Gets all annotations which are declared on this annotated item with the given meta annotation type

Specified by:
getDeclaredMetaAnnotations in interface WeldClass<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 interface WeldClass<T>


Copyright © 2013 Seam Framework. All Rights Reserved.