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

java.lang.Object
  extended by org.jboss.weld.introspector.jlr.AbstractWeldAnnotated<T,java.lang.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,java.lang.Class<T>>, WeldClass<T>
Direct Known Subclasses:
WeldAnnotationImpl

public class WeldClassImpl<T>
extends AbstractWeldAnnotated<T,java.lang.Class<T>>
implements WeldClass<T>

Represents an annotated class This class is immutable, and therefore threadsafe

Author:
Pete Muir, David Allen

Field Summary
 
Fields inherited from interface org.jboss.weld.introspector.WeldAnnotated
MAPPED_DECLARED_METAANNOTATIONS, MAPPED_METAANNOTATIONS
 
Constructor Summary
protected WeldClassImpl(java.lang.Class<T> rawType, java.lang.reflect.Type type, javax.enterprise.inject.spi.AnnotatedType<T> annotatedType, java.util.Set<java.lang.reflect.Type> typeClosure, java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> annotationMap, java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> declaredAnnotationMap, ClassTransformer classTransformer)
           
 
Method Summary
<U> WeldClass<? extends U>
asWeldSubclass(WeldClass<U> clazz)
           
<S> S
cast(java.lang.Object object)
           
 boolean equals(java.lang.Object other)
          Compares two AbstractAnnotatedItems
 java.lang.Class<? extends T> getAnnotatedClass()
          Gets the implementing class
 java.util.Set<javax.enterprise.inject.spi.AnnotatedConstructor<T>> getConstructors()
           
 java.util.Set<WeldField<?,?>> getDeclaredFields()
           
 java.util.Set<java.lang.annotation.Annotation> getDeclaredMetaAnnotations(java.lang.Class<? extends java.lang.annotation.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(java.lang.String fieldName)
          Get a field by name
 java.util.Set<WeldField<?,? super T>> getDeclaredWeldFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets all fields which are annotated with the given annotation type on this class only.
 WeldMethod<?,?> getDeclaredWeldMethod(java.lang.reflect.Method method)
           
<M> WeldMethod<M,?>
getDeclaredWeldMethod(MethodSignature signature)
          Get a method by name
 java.util.Set<WeldMethod<?,?>> getDeclaredWeldMethods()
          Gets all fields on the type
 java.util.Set<WeldMethod<?,? super T>> getDeclaredWeldMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets all methods annotated with annotationType
 java.util.Set<WeldMethod<?,? super T>> getDeclaredWeldMethodsWithAnnotatedParameters(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets all with parameters annotated with annotationType
 java.lang.Class<T> getDelegate()
          Gets the delegate (class)
 java.util.Set<javax.enterprise.inject.spi.AnnotatedField<? super T>> getFields()
           
 java.util.Set<javax.enterprise.inject.spi.AnnotatedMethod<? super T>> getMethods()
           
 java.lang.String getName()
          Gets the name of the type
 WeldConstructor<T> getNoArgsWeldConstructor()
          Gets the no-args constructor
 java.lang.Package getPackage()
           
 java.lang.String getSimpleName()
           
 java.util.Set<WeldConstructor<T>> getWeldConstructors(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets constructors with given annotation type
 java.util.Set<WeldField<?,?>> getWeldFields()
          Gets the abstracted fields of the class Initializes the fields if they are null
 java.util.Set<WeldField<?,?>> getWeldFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets the abstracted field annotated with a specific annotation type If the fields map is null, initialize it first
 WeldMethod<?,?> getWeldMethod(java.lang.reflect.Method methodDescriptor)
          Find the annotated method for a given methodDescriptor
<M> WeldMethod<M,?>
getWeldMethod(MethodSignature signature)
          Get a method by name
 java.util.Set<WeldMethod<?,?>> getWeldMethods()
          Gets all fields on the type
 java.util.Set<WeldMethod<?,?>> getWeldMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets the abstracted methods that have a certain annotation type present If the annotated methods map is null, initialize it first
 WeldClass<?> getWeldSuperclass()
          Gets the superclass abstraction of the type
 boolean isAbstract()
           
 boolean isAnonymousClass()
           
 boolean isDiscovered()
           
 boolean isEnum()
           
 boolean isEquivalent(java.lang.Class<?> clazz)
          Check if this is equivalent to a java class
 boolean isFinal()
          Indicates if the type if final
 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(java.lang.Class<T> clazz, ClassTransformer classTransformer)
           
static
<T> WeldClass<T>
of(java.lang.Class<T> rawType, java.lang.reflect.Type type, ClassTransformer classTransformer)
           
 java.lang.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, hashCode, isAnnotationPresent, isParameterizedType, isPrimitive, isProxyable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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, isProxyable
 
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(java.lang.Class<T> rawType,
                        java.lang.reflect.Type type,
                        javax.enterprise.inject.spi.AnnotatedType<T> annotatedType,
                        java.util.Set<java.lang.reflect.Type> typeClosure,
                        java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> annotationMap,
                        java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> declaredAnnotationMap,
                        ClassTransformer classTransformer)
Method Detail

of

public static <T> WeldClass<T> of(java.lang.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(java.lang.Class<T> rawType,
                                  java.lang.reflect.Type type,
                                  ClassTransformer classTransformer)

equals

public boolean equals(java.lang.Object other)
Description copied from class: AbstractWeldAnnotated
Compares two AbstractAnnotatedItems

Overrides:
equals in class AbstractWeldAnnotated<T,java.lang.Class<T>>
Parameters:
other - The other item
Returns:
True if equals, false otherwise

getAnnotatedClass

public java.lang.Class<? extends T> getAnnotatedClass()
Gets the implementing class

Returns:
The class

getDelegate

public java.lang.Class<T> getDelegate()
Gets the delegate (class)

Specified by:
getDelegate in class AbstractWeldAnnotated<T,java.lang.Class<T>>
Returns:
The class

getWeldFields

public java.util.Set<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 java.util.Set<WeldField<?,?>> getDeclaredFields()

getDeclaredWeldField

public <F> WeldField<F,?> getDeclaredWeldField(java.lang.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 java.util.Set<WeldField<?,? super T>> getDeclaredWeldFields(java.lang.Class<? extends java.lang.annotation.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 java.util.Set<WeldField<?,?>> getWeldFields(java.lang.Class<? extends java.lang.annotation.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 java.util.Set<WeldMethod<?,?>> getWeldMethods(java.lang.Class<? extends java.lang.annotation.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 java.util.Set<WeldMethod<?,? super T>> getDeclaredWeldMethods(java.lang.Class<? extends java.lang.annotation.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 java.util.Set<WeldConstructor<T>> getWeldConstructors(java.lang.Class<? extends java.lang.annotation.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 java.util.Set<WeldMethod<?,? super T>> getDeclaredWeldMethodsWithAnnotatedParameters(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: WeldClass
Gets all 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(java.lang.reflect.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 java.util.Set<WeldMethod<?,?>> 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(java.lang.reflect.Method method)
Specified by:
getDeclaredWeldMethod in interface WeldClass<T>

getDeclaredWeldMethods

public java.util.Set<WeldMethod<?,?>> 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 java.lang.String toString()
Gets a string representation of the class

Overrides:
toString in class java.lang.Object
Returns:
A string representation

getSimpleName

public java.lang.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,java.lang.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,java.lang.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,java.lang.Class<T>>
Returns:
if public, returns true

getName

public java.lang.String getName()
Gets the name of the type

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

getWeldSuperclass

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

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

isEquivalent

public boolean isEquivalent(java.lang.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,java.lang.Class<T>>

isPackagePrivate

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

getPackage

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

asWeldSubclass

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

cast

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

getConstructors

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

getFields

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

getMethods

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

getDeclaredMetaAnnotations

public java.util.Set<java.lang.annotation.Annotation> getDeclaredMetaAnnotations(java.lang.Class<? extends java.lang.annotation.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 © 2008-2010 Seam Framework. All Rights Reserved.