org.jboss.kernel.plugins.annotations
Class AbstractAnnotationPlugin<T extends org.jboss.reflect.spi.AnnotatedInfo,C extends Annotation>

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.kernel.plugins.annotations.AbstractAnnotationPlugin<T,C>
Type Parameters:
T - info type
C - annotation type
All Implemented Interfaces:
Cloneable, AnnotationPlugin<T,C>, org.jboss.util.JBossInterface
Direct Known Subclasses:
AbstractAdaptersAnnotationPlugin, CallbackAnnotationPlugin, ClassAnnotationPlugin, ConstructorAnnotationPlugin, FieldAnnotationPlugin, MethodAnnotationPlugin, PropertyAnnotationPlugin

public abstract class AbstractAnnotationPlugin<T extends org.jboss.reflect.spi.AnnotatedInfo,C extends Annotation>
extends org.jboss.util.JBossObject
implements AnnotationPlugin<T,C>

Abstract annotation plugin.

Author:
Ales Justin

Field Summary
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Constructor Summary
protected AbstractAnnotationPlugin(Class<C> annotation)
           
 
Method Summary
 void applyAnnotation(T info, org.jboss.metadata.spi.MetaData retrieval, MetaDataVisitor visitor)
          Apply the check for annotation.
 void cleanAnnotation(T info, org.jboss.metadata.spi.MetaData retrieval, MetaDataVisitor visitor)
          Check if the annotation requires cleaning after itself.
 Class<C> getAnnotation()
          Get the annotation class we are handling.
 Set<ElementType> getSupportedTypes()
          Get all supported types.
protected  List<? extends MetaDataVisitorNode> internalApplyAnnotation(T info, C annotation, BeanMetaData beanMetaData)
          Apply annotation since it's not present.
protected  List<? extends MetaDataVisitorNode> internalApplyAnnotation(T info, C annotation, KernelControllerContext context)
          Apply annotation since it's not present.
protected  List<? extends MetaDataVisitorNode> internalApplyAnnotation(T info, org.jboss.metadata.spi.MetaData retrieval, C annotation, KernelControllerContext context)
          Apply annotation since it's not present.
protected  void internalCleanAnnotation(T info, org.jboss.metadata.spi.MetaData retrieval, C annotation, KernelControllerContext context)
          Clean annotation's actions.
protected static boolean isAttributePresent(String value)
          Does attribute have value.
protected abstract  boolean isElementTypeSupported(ElementType type)
          Is type supported by plugin.
protected  boolean isMetaDataAlreadyPresent(T info, C annotation, BeanMetaData beanMetaData)
          Is meta data already present.
protected  boolean isMetaDataAlreadyPresent(T info, C annotation, KernelControllerContext context)
          Is meta data already present.
 void toShortString(org.jboss.util.JBossStringBuilder buffer)
           
protected  void toString(org.jboss.util.JBossStringBuilder buffer)
           
 
Methods inherited from class org.jboss.util.JBossObject
cacheGetHashCode, cacheToString, clone, equals, flushJBossObjectCache, getClassShortName, getHashCode, hashCode, list, notEqual, toShortString, toString, toStringImplementation
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractAnnotationPlugin

protected AbstractAnnotationPlugin(Class<C> annotation)
Method Detail

isAttributePresent

protected static boolean isAttributePresent(String value)
Does attribute have value. Helper method.

Parameters:
value - the value
Returns:
true if atribute not null or non-empty

isElementTypeSupported

protected abstract boolean isElementTypeSupported(ElementType type)
Is type supported by plugin.

Parameters:
type - the annotation element type
Returns:
true if element supported

getSupportedTypes

public Set<ElementType> getSupportedTypes()
Description copied from interface: AnnotationPlugin
Get all supported types.

Specified by:
getSupportedTypes in interface AnnotationPlugin<T extends org.jboss.reflect.spi.AnnotatedInfo,C extends Annotation>
Returns:
set of supported types

getAnnotation

public Class<C> getAnnotation()
Description copied from interface: AnnotationPlugin
Get the annotation class we are handling.

Specified by:
getAnnotation in interface AnnotationPlugin<T extends org.jboss.reflect.spi.AnnotatedInfo,C extends Annotation>
Returns:
annotation class

isMetaDataAlreadyPresent

protected boolean isMetaDataAlreadyPresent(T info,
                                           C annotation,
                                           KernelControllerContext context)
Is meta data already present.

Parameters:
info - the info
annotation - the annotation
context - the context
Returns:
true if meta data already present

isMetaDataAlreadyPresent

protected boolean isMetaDataAlreadyPresent(T info,
                                           C annotation,
                                           BeanMetaData beanMetaData)
Is meta data already present.

Parameters:
info - the info
annotation - the annotation
beanMetaData - the bean meta data
Returns:
true if meta data already present

internalApplyAnnotation

protected List<? extends MetaDataVisitorNode> internalApplyAnnotation(T info,
                                                                      org.jboss.metadata.spi.MetaData retrieval,
                                                                      C annotation,
                                                                      KernelControllerContext context)
                                                               throws Throwable
Apply annotation since it's not present.

Parameters:
info - the info
retrieval - the metadata
annotation - the annotation
context - the context
Returns:
list of added meta data visitor nodes
Throws:
Throwable - for any error

internalApplyAnnotation

protected List<? extends MetaDataVisitorNode> internalApplyAnnotation(T info,
                                                                      C annotation,
                                                                      KernelControllerContext context)
                                                               throws Throwable
Apply annotation since it's not present.

Parameters:
info - the info
annotation - the annotation
context - the context
Returns:
list of added meta data visitor nodes
Throws:
Throwable - for any error

internalApplyAnnotation

protected List<? extends MetaDataVisitorNode> internalApplyAnnotation(T info,
                                                                      C annotation,
                                                                      BeanMetaData beanMetaData)
                                                               throws Throwable
Apply annotation since it's not present.

Parameters:
info - the info
annotation - the annotation
beanMetaData - the bean meta data
Returns:
list of added meta data visitor nodes
Throws:
Throwable - for any error

applyAnnotation

public final void applyAnnotation(T info,
                                  org.jboss.metadata.spi.MetaData retrieval,
                                  MetaDataVisitor visitor)
                           throws Throwable
Description copied from interface: AnnotationPlugin
Apply the check for annotation.

Specified by:
applyAnnotation in interface AnnotationPlugin<T extends org.jboss.reflect.spi.AnnotatedInfo,C extends Annotation>
Parameters:
info - the info
retrieval - metadata instance
visitor - current context visitor
Throws:
Throwable - for any error

cleanAnnotation

public void cleanAnnotation(T info,
                            org.jboss.metadata.spi.MetaData retrieval,
                            MetaDataVisitor visitor)
                     throws Throwable
Description copied from interface: AnnotationPlugin
Check if the annotation requires cleaning after itself.

Specified by:
cleanAnnotation in interface AnnotationPlugin<T extends org.jboss.reflect.spi.AnnotatedInfo,C extends Annotation>
Parameters:
info - the info
retrieval - metadata instance
visitor - current context visitor
Throws:
Throwable - for any error

internalCleanAnnotation

protected void internalCleanAnnotation(T info,
                                       org.jboss.metadata.spi.MetaData retrieval,
                                       C annotation,
                                       KernelControllerContext context)
                                throws Throwable
Clean annotation's actions.

Parameters:
info - the info
retrieval - the metadata
annotation - the annotation
context - the context
Throws:
Throwable - for any error

toString

protected void toString(org.jboss.util.JBossStringBuilder buffer)
Overrides:
toString in class org.jboss.util.JBossObject

toShortString

public void toShortString(org.jboss.util.JBossStringBuilder buffer)
Specified by:
toShortString in interface org.jboss.util.JBossInterface
Overrides:
toShortString in class org.jboss.util.JBossObject


Copyright ? 2007 JBoss Inc.. All Rights Reserved.