org.jboss.webbeans.introspector.jlr
Class AbstractAnnotatedItem<T,S>

java.lang.Object
  extended by org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem<T,S>
Type Parameters:
T -
S -
All Implemented Interfaces:
AnnotatedItem<T,S>
Direct Known Subclasses:
AbstractAnnotatedMember, AbstractAnnotatedType, AnnotatedParameterImpl, ResolvableAnnotatedClass

public abstract class AbstractAnnotatedItem<T,S>
extends java.lang.Object
implements AnnotatedItem<T,S>

Represents functionality common for all annotated items, mainly different mappings of the annotations and meta-annotations AbstractAnnotatedItem is an immutable class and therefore threadsafe

Author:
Pete Muir, Nicklas Karlsson
See Also:
AnnotatedItem

Field Summary
 
Fields inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
MAPPED_METAANNOTATIONS
 
Constructor Summary
AbstractAnnotatedItem(AnnotationStore annotatedItemHelper)
           
AbstractAnnotatedItem(AnnotationStore annotatedItemHelper, java.lang.Class<T> rawType, java.lang.reflect.Type type)
          Constructor Also builds the meta-annotation map.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares two AbstractAnnotatedItems
 java.lang.reflect.Type[] getActualTypeArguments()
          Gets the actual type arguments for any parameterized types that this AnnotatedItem represents.
<A extends java.lang.annotation.Annotation>
A
getAnnotation(java.lang.Class<A> annotationType)
          Gets an annotation for the annotation type specified.
 java.util.Set<java.lang.annotation.Annotation> getAnnotationsAsSet()
          Gets all annotations on the item
 AnnotationStore getAnnotationStore()
           
 java.util.Set<java.lang.annotation.Annotation> getBindings()
          Deprecated. 
 java.lang.annotation.Annotation[] getBindingsAsArray()
          Deprecated. 
 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
abstract  S getDelegate()
           
 java.util.Set<? extends java.lang.reflect.Type> getFlattenedTypeHierarchy()
           
 java.util.Set<java.lang.annotation.Annotation> getMetaAnnotations(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
          Gets all annotations which are annotated with the given meta annotation type
 java.lang.annotation.Annotation[] getMetaAnnotationsAsArray(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
          Gets all annotations which are annotated with the given meta annotation type
 java.lang.Class<T> getRawType()
          Gets the type of the element
 java.lang.reflect.Type getType()
           
 int hashCode()
          Gets the hash code of the actual type
 boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotatedType)
          Checks if an annotation is present on the item
 boolean isAssignableFrom(AnnotatedItem<?,?> that)
          Checks if this item is assignable from another annotated item (through type and actual type arguments)
 boolean isAssignableFrom(java.util.Set<? extends java.lang.reflect.Type> types)
          Checks if this item is assignable from any one a set of types
 boolean isDeclaredAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Indicates if an annotation type specified is present
 boolean isParameterizedType()
           
 boolean isProxyable()
          Indicates if the type is proxyable to a set of pre-defined rules
 java.lang.String toString()
          Gets a string representation of the item
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
getName, isFinal, isPublic, isStatic
 

Constructor Detail

AbstractAnnotatedItem

public AbstractAnnotatedItem(AnnotationStore annotatedItemHelper,
                             java.lang.Class<T> rawType,
                             java.lang.reflect.Type type)
Constructor Also builds the meta-annotation map. Throws a NullPointerException if trying to register a null map

Parameters:
annotationMap - A map of annotation to register

AbstractAnnotatedItem

public AbstractAnnotatedItem(AnnotationStore annotatedItemHelper)
Method Detail

getAnnotationStore

public AnnotationStore getAnnotationStore()
Specified by:
getAnnotationStore in interface AnnotatedItem<T,S>

getAnnotation

public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> annotationType)
Description copied from interface: AnnotatedItem
Gets an annotation for the annotation type specified.

Specified by:
getAnnotation in interface AnnotatedItem<T,S>
Parameters:
annotationType - The annotation to match
Returns:
An annotation if found, null if the annotation wasn't present.

getMetaAnnotations

public java.util.Set<java.lang.annotation.Annotation> getMetaAnnotations(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
Description copied from interface: AnnotatedItem
Gets all annotations which are annotated with the given meta annotation type

Specified by:
getMetaAnnotations in interface AnnotatedItem<T,S>
Returns:
A set of matching meta-annotations. Returns an empty set if there are no matches.

getDeclaredMetaAnnotations

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

Specified by:
getDeclaredMetaAnnotations in interface AnnotatedItem<T,S>
Returns:
A set of matching meta-annotations. Returns an empty set if there are no matches.

getMetaAnnotationsAsArray

public java.lang.annotation.Annotation[] getMetaAnnotationsAsArray(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
Description copied from interface: AnnotatedItem
Gets all annotations which are annotated with the given meta annotation type

Specified by:
getMetaAnnotationsAsArray in interface AnnotatedItem<T,S>
Returns:
An array of matching meta-annotations. Returns an empty array if there are no matches.

getAnnotationsAsSet

public java.util.Set<java.lang.annotation.Annotation> getAnnotationsAsSet()
Description copied from interface: AnnotatedItem
Gets all annotations on the item

Specified by:
getAnnotationsAsSet in interface AnnotatedItem<T,S>
Returns:
A set of annotations. Returns an empty set if there are no matches.

isAnnotationPresent

public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotatedType)
Checks if an annotation is present on the item

Specified by:
isAnnotationPresent in interface AnnotatedItem<T,S>
Parameters:
annotatedType - The annotation type to check for
Returns:
True if present, false otherwise.
See Also:
AnnotatedItem.isAnnotationPresent(Class)

equals

public boolean equals(java.lang.Object other)
Compares two AbstractAnnotatedItems

Overrides:
equals in class java.lang.Object
Parameters:
other - The other item
Returns:
True if equals, false otherwise

isAssignableFrom

public boolean isAssignableFrom(AnnotatedItem<?,?> that)
Checks if this item is assignable from another annotated item (through type and actual type arguments)

Specified by:
isAssignableFrom in interface AnnotatedItem<T,S>
Parameters:
that - The other annotated item to check against
Returns:
True if assignable, false otherwise
See Also:
AnnotatedItem.isAssignableFrom(AnnotatedItem)

isAssignableFrom

public boolean isAssignableFrom(java.util.Set<? extends java.lang.reflect.Type> types)
Checks if this item is assignable from any one a set of types

Specified by:
isAssignableFrom in interface AnnotatedItem<T,S>
Parameters:
types - The set of types to check against
Returns:
True if assignable, false otherwise
See Also:
AnnotatedItem.isAssignableFrom(Set)

hashCode

public int hashCode()
Gets the hash code of the actual type

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code

toString

public java.lang.String toString()
Gets a string representation of the item

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

getBindings

@Deprecated
public java.util.Set<java.lang.annotation.Annotation> getBindings()
Deprecated. 

Description copied from interface: AnnotatedItem
Gets the binding types for this element

Specified by:
getBindings in interface AnnotatedItem<T,S>

getBindingsAsArray

@Deprecated
public java.lang.annotation.Annotation[] getBindingsAsArray()
Deprecated. 

Gets (as array) the binding types of the item Looks at the meta-annotations map for annotations with binding type meta-annotation. Returns default binding (current) if none specified.

Specified by:
getBindingsAsArray in interface AnnotatedItem<T,S>
Returns:
An array of (binding type) annotations
See Also:
AnnotatedItem.getBindingsAsArray()

isProxyable

public boolean isProxyable()
Indicates if the type is proxyable to a set of pre-defined rules

Specified by:
isProxyable in interface AnnotatedItem<T,S>
Returns:
True if proxyable, false otherwise.
See Also:
AnnotatedItem.isProxyable()

getRawType

public java.lang.Class<T> getRawType()
Description copied from interface: AnnotatedItem
Gets the type of the element

Specified by:
getRawType in interface AnnotatedItem<T,S>
Returns:
The type of the element

getType

public java.lang.reflect.Type getType()
Specified by:
getType in interface AnnotatedItem<T,S>

getActualTypeArguments

public java.lang.reflect.Type[] getActualTypeArguments()
Description copied from interface: AnnotatedItem
Gets the actual type arguments for any parameterized types that this AnnotatedItem represents.

Specified by:
getActualTypeArguments in interface AnnotatedItem<T,S>
Returns:
An array of type arguments

getFlattenedTypeHierarchy

public java.util.Set<? extends java.lang.reflect.Type> getFlattenedTypeHierarchy()
Specified by:
getFlattenedTypeHierarchy in interface AnnotatedItem<T,S>

getDelegate

public abstract S getDelegate()

isDeclaredAnnotationPresent

public boolean isDeclaredAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: AnnotatedItem
Indicates if an annotation type specified is present

Specified by:
isDeclaredAnnotationPresent in interface AnnotatedItem<T,S>
Parameters:
annotationType - The annotation to match
Returns:
True if present, false if not

isParameterizedType

public boolean isParameterizedType()
Specified by:
isParameterizedType in interface AnnotatedItem<T,S>


Copyright © 2011. All Rights Reserved.