org.jboss.kernel.plugins.annotations
Class BaseMetaDataAnnotationPlugin<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.BaseMetaDataAnnotationPlugin<T,C>
Type Parameters:
T - info type
C - annotation type
All Implemented Interfaces:
Cloneable, MetaDataAnnotationPlugin<T,C>, org.jboss.util.JBossInterface
Direct Known Subclasses:
AbstractAnnotationPlugin

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

Annotation plugin based on bean metadata.

Author:
Ales Justin

Field Summary
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Constructor Summary
protected BaseMetaDataAnnotationPlugin(Class<C> annotation)
           
 
Method Summary
 void applyAnnotation(T info, org.jboss.metadata.spi.MetaData retrieval, BeanMetaData beanMetaData)
          Apply annotations to bean metadata.
 Class<C> getAnnotation()
          Get the annotation class we are handling.
 Set<ElementType> getSupportedTypes()
          Get all supported types.
protected abstract  Object internalApplyAnnotation(T info, C annotation, BeanMetaData beanMetaData)
          Apply annotation since it's not present.
protected  Object internalApplyAnnotation(T info, org.jboss.metadata.spi.MetaData retrieval, C annotation, BeanMetaData beanMetaData)
          Apply annotation since it's not present.
protected static boolean isAttributePresent(Class<?> value)
          Does attribute have value.
protected static boolean isAttributePresent(String value)
          Does attribute have value.
protected  boolean isCleanup()
          Is annotation marked as cleanup.
protected  boolean isCleanupOnly()
          Is annotation marked as cleanup only.
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.
 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

BaseMetaDataAnnotationPlugin

protected BaseMetaDataAnnotationPlugin(Class<C> annotation)
Method Detail

applyAnnotation

public final void applyAnnotation(T info,
                                  org.jboss.metadata.spi.MetaData retrieval,
                                  BeanMetaData beanMetaData)
                           throws Throwable
Description copied from interface: MetaDataAnnotationPlugin
Apply annotations to bean metadata.

Specified by:
applyAnnotation in interface MetaDataAnnotationPlugin<T extends org.jboss.reflect.spi.AnnotatedInfo,C extends Annotation>
Parameters:
info - the annotated info we are checking
retrieval - the metadata retrieval
beanMetaData - the bean metadata
Throws:
Throwable - for any error

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 Object internalApplyAnnotation(T info,
                                         org.jboss.metadata.spi.MetaData retrieval,
                                         C annotation,
                                         BeanMetaData beanMetaData)
                                  throws Throwable
Apply annotation since it's not present.

Parameters:
info - the info
retrieval - the metadata
annotation - the annotation
beanMetaData - the bean meta data
Returns:
used to return covariant type
Throws:
Throwable - for any error

internalApplyAnnotation

protected abstract Object 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:
used to return covariant type
Throws:
Throwable - for any error

isCleanup

protected boolean isCleanup()
Is annotation marked as cleanup.

Returns:
true if cleanup annotation

isCleanupOnly

protected boolean isCleanupOnly()
Is annotation marked as cleanup only.

Returns:
true if clean up only

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

isAttributePresent

protected static boolean isAttributePresent(Class<?> value)
Does attribute have value. Helper method.

Parameters:
value - the value
Returns:
true if atribute not void.class

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: MetaDataAnnotationPlugin
Get all supported types.

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

getAnnotation

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

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

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 © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.