org.jboss.webbeans.introspector.jlr
Class AnnotatedClassImpl<T>

java.lang.Object
  extended by org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem<T,java.lang.Class<T>>
      extended by org.jboss.webbeans.introspector.jlr.AbstractAnnotatedType<T>
          extended by org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl<T>
Type Parameters:
T -
All Implemented Interfaces:
AnnotatedClass<T>, AnnotatedItem<T,java.lang.Class<T>>, AnnotatedType<T>

public class AnnotatedClassImpl<T>
extends AbstractAnnotatedType<T>
implements AnnotatedClass<T>

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

Author:
Pete Muir

Field Summary
 
Fields inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
MAPPED_METAANNOTATIONS
 
Method Summary
<U> AnnotatedClass<? extends U>
asSubclass(AnnotatedClass<U> clazz)
           
 T cast(java.lang.Object object)
           
 java.lang.Class<? extends T> getAnnotatedClass()
          Gets the implementing class
 java.util.Set<AnnotatedConstructor<T>> getAnnotatedConstructors(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets constructors with given annotation type
 java.util.Set<AnnotatedField<?>> getAnnotatedFields(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
 java.util.Set<AnnotatedMethod<?>> getAnnotatedMethods(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
 java.util.Set<AnnotatedConstructor<T>> getConstructors()
          Gets the abstracted constructors of the class Initializes the constructors if they are null
 java.util.Set<AnnotatedField<?>> getDeclaredAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets all fields which are annotated with the given annotation type on this class only.
 java.util.Set<AnnotatedMethod<?>> getDeclaredAnnotatedMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets all methods annotated with annotationType
 AnnotatedConstructor<T> getDeclaredConstructor(ConstructorSignature signature)
          Get the constructor which matches the argument list provided
<F> AnnotatedField<F>
getDeclaredField(java.lang.String fieldName, AnnotatedClass<F> expectedType)
          Get a field by name
 java.util.Set<AnnotatedField<?>> getDeclaredFields()
           
 AnnotatedMethod<?> getDeclaredMethod(java.lang.reflect.Method method)
           
<M> AnnotatedMethod<M>
getDeclaredMethod(MethodSignature signature, AnnotatedClass<M> expectedReturnType)
          Get a method by name
 java.util.Set<AnnotatedMethod<?>> getDeclaredMethodsWithAnnotatedParameters(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<AnnotatedField<?>> getFields()
          Gets the abstracted fields of the class Initializes the fields if they are null
 java.util.Set<AnnotatedField<?>> getMetaAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
          Gets abstracted fields with requested meta-annotation type present If the meta-annotations map is null, it is initializes.
 AnnotatedMethod<?> getMethod(java.lang.reflect.Method methodDescriptor)
          Find the annotated method for a given methodDescriptor
 java.util.Set<AnnotatedMethod<?>> getMethodsWithAnnotatedParameters(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Gets all with parameters annotated with annotationType
 AnnotatedConstructor<T> getNoArgsConstructor()
          Gets the no-args constructor
 boolean isAbstract()
           
 boolean isEnum()
           
 boolean isNonStaticMemberClass()
          Determine if this is a non-static member class
static
<T> AnnotatedClass<T>
of(java.lang.Class<T> clazz, ClassTransformer classTransformer)
           
 java.lang.String toString()
          Gets a string representation of the class
 
Methods inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedType
getName, getSimpleName, getSuperclass, isEquivalent, isFinal, isPublic, isStatic
 
Methods inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem
equals, getActualTypeArguments, getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindings, getBindingsAsArray, getDeclaredMetaAnnotations, getFlattenedTypeHierarchy, getMetaAnnotations, getMetaAnnotationsAsArray, getRawType, getType, hashCode, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isParameterizedType, isProxyable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedClass
getSuperclass, isParameterizedType
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedType
getSimpleName, isEquivalent
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
getActualTypeArguments, getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindings, getBindingsAsArray, getDeclaredMetaAnnotations, getFlattenedTypeHierarchy, getMetaAnnotations, getMetaAnnotationsAsArray, getName, getRawType, getType, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isFinal, isProxyable, isPublic, isStatic
 

Method Detail

of

public static <T> AnnotatedClass<T> of(java.lang.Class<T> clazz,
                                       ClassTransformer classTransformer)

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 AbstractAnnotatedItem<T,java.lang.Class<T>>
Returns:
The class

getFields

public java.util.Set<AnnotatedField<?>> getFields()
Gets the abstracted fields of the class Initializes the fields if they are null

Specified by:
getFields in interface AnnotatedClass<T>
Returns:
The set of abstracted fields

getDeclaredFields

public java.util.Set<AnnotatedField<?>> getDeclaredFields()

getDeclaredField

public <F> AnnotatedField<F> getDeclaredField(java.lang.String fieldName,
                                              AnnotatedClass<F> expectedType)
Description copied from interface: AnnotatedClass
Get a field by name

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

getDeclaredAnnotatedFields

public java.util.Set<AnnotatedField<?>> getDeclaredAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: AnnotatedClass
Gets all fields which are annotated with the given annotation type on this class only.

Specified by:
getDeclaredAnnotatedFields in interface AnnotatedClass<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

getConstructors

public java.util.Set<AnnotatedConstructor<T>> getConstructors()
Gets the abstracted constructors of the class Initializes the constructors if they are null

Specified by:
getConstructors in interface AnnotatedClass<T>
Returns:
The set of abstracted constructors

getDeclaredConstructor

public AnnotatedConstructor<T> getDeclaredConstructor(ConstructorSignature signature)
Description copied from interface: AnnotatedClass
Get the constructor which matches the argument list provided

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

getMetaAnnotatedFields

public java.util.Set<AnnotatedField<?>> getMetaAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
Gets abstracted fields with requested meta-annotation type present If the meta-annotations map is null, it is initializes. If the annotated fields are null, it is initialized The meta-annotated field map is then populated for the requested meta-annotation type and the result is returned

Specified by:
getMetaAnnotatedFields in interface AnnotatedClass<T>
Parameters:
metaAnnotationType - The meta-annotation type to match
Returns:
The set of abstracted fields with meta-annotation present. Returns an empty set if no matches are found.

getAnnotatedFields

public java.util.Set<AnnotatedField<?>> getAnnotatedFields(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:
getAnnotatedFields in interface AnnotatedClass<T>
Parameters:
annotationType - The annotation type to match
Returns:
A set of matching abstracted fields, null if none are found.

isNonStaticMemberClass

public boolean isNonStaticMemberClass()
Description copied from interface: AnnotatedClass
Determine if this is a non-static member class

Specified by:
isNonStaticMemberClass in interface AnnotatedClass<T>
Returns:
true if this is a non-static member

isAbstract

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

isEnum

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

getAnnotatedMethods

public java.util.Set<AnnotatedMethod<?>> getAnnotatedMethods(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:
getAnnotatedMethods in interface AnnotatedClass<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:
AnnotatedClass.getAnnotatedMethods(Class)

getDeclaredAnnotatedMethods

public java.util.Set<AnnotatedMethod<?>> getDeclaredAnnotatedMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: AnnotatedClass
Gets all methods annotated with annotationType

Specified by:
getDeclaredAnnotatedMethods in interface AnnotatedClass<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

getAnnotatedConstructors

public java.util.Set<AnnotatedConstructor<T>> getAnnotatedConstructors(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Gets constructors with given annotation type

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

getNoArgsConstructor

public AnnotatedConstructor<T> getNoArgsConstructor()
Description copied from interface: AnnotatedClass
Gets the no-args constructor

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

getMethodsWithAnnotatedParameters

public java.util.Set<AnnotatedMethod<?>> getMethodsWithAnnotatedParameters(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: AnnotatedClass
Gets all with parameters annotated with annotationType

Specified by:
getMethodsWithAnnotatedParameters in interface AnnotatedClass<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

getDeclaredMethodsWithAnnotatedParameters

public java.util.Set<AnnotatedMethod<?>> getDeclaredMethodsWithAnnotatedParameters(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: AnnotatedClass
Gets all with parameters annotated with annotationType

Specified by:
getDeclaredMethodsWithAnnotatedParameters in interface AnnotatedClass<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

getMethod

public AnnotatedMethod<?> getMethod(java.lang.reflect.Method methodDescriptor)
Description copied from interface: AnnotatedClass
Find the annotated method for a given methodDescriptor

Specified by:
getMethod in interface AnnotatedClass<T>
Returns:
TODO Replace with AnnotatedMethod variant

getDeclaredMethod

public AnnotatedMethod<?> getDeclaredMethod(java.lang.reflect.Method method)
Specified by:
getDeclaredMethod in interface AnnotatedClass<T>

getDeclaredMethod

public <M> AnnotatedMethod<M> getDeclaredMethod(MethodSignature signature,
                                                AnnotatedClass<M> expectedReturnType)
Description copied from interface: AnnotatedClass
Get a method by name

Specified by:
getDeclaredMethod in interface AnnotatedClass<T>
Type Parameters:
M - the expected return type
Parameters:
signature - the name of the method
expectedReturnType - the expected return type
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 AbstractAnnotatedType<T>
Returns:
A string representation

asSubclass

public <U> AnnotatedClass<? extends U> asSubclass(AnnotatedClass<U> clazz)
Specified by:
asSubclass in interface AnnotatedClass<T>

cast

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


Copyright © 2011. All Rights Reserved.