org.jboss.kernel.plugins.annotations
Class CommonAnnotationAdapter<T extends MetaDataAnnotationPlugin<?,?>,U>

java.lang.Object
  extended by org.jboss.kernel.plugins.annotations.CommonAnnotationAdapter<T,U>
Type Parameters:
T - exact annotation plugin type
U - exact handle type
Direct Known Subclasses:
AbstractBeanAnnotationAdapter, AbstractMetaDataAnnotationAdapter

public abstract class CommonAnnotationAdapter<T extends MetaDataAnnotationPlugin<?,?>,U>
extends Object

Common bean annotation handler.

Author:
Ales Justin

Field Summary
protected  org.jboss.logging.Logger log
          The log
 
Constructor Summary
CommonAnnotationAdapter()
           
 
Method Summary
 void addAnnotationPlugin(T plugin)
          Add the annotation plugin.
protected abstract  void applyPlugin(T plugin, org.jboss.reflect.spi.AnnotatedInfo info, org.jboss.metadata.spi.MetaData retrieval, U handle)
          Apply plugin.
protected abstract  void cleanPlugin(T plugin, org.jboss.reflect.spi.AnnotatedInfo info, org.jboss.metadata.spi.MetaData retrieval, U handle)
          Clean plugin.
protected abstract  Object getName(U handle)
          Get the name from handle.
protected  Iterable<T> getPlugins(ElementType type, org.jboss.kernel.plugins.annotations.AnnotationPluginFilter filter, Collection<Class<? extends Annotation>> annotationClasses)
          Get plugins.
protected  org.jboss.reflect.spi.MethodInfo[] getStaticMethods(org.jboss.reflect.spi.ClassInfo classInfo)
          Get the static methods of class info.
protected  void handleAnnotations(org.jboss.beans.info.spi.BeanInfo info, org.jboss.metadata.spi.MetaData retrieval, U handle, boolean isApplyPhase)
          Handle apply or cleanup of annotations.
protected  void handleMethod(org.jboss.metadata.spi.MetaData retrieval, U handle, boolean isApplyPhase, boolean trace, Set<org.jboss.reflect.spi.MethodInfo> visitedMethods, org.jboss.beans.info.spi.PropertyInfo pi, org.jboss.reflect.spi.MethodInfo method, String type, Collection<Class<? extends Annotation>> annotationClasses)
          Handle setter or getter on property.
 void removeAnnotationPlugin(T plugin)
          Remove the plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.jboss.logging.Logger log
The log

Constructor Detail

CommonAnnotationAdapter

public CommonAnnotationAdapter()
Method Detail

addAnnotationPlugin

public void addAnnotationPlugin(T plugin)
Add the annotation plugin. Breaks down the plugin usage into different ElementType support collections.

Parameters:
plugin - the annotation plugin

removeAnnotationPlugin

public void removeAnnotationPlugin(T plugin)
Remove the plugin.

Parameters:
plugin - the annotation plugin

applyPlugin

protected abstract void applyPlugin(T plugin,
                                    org.jboss.reflect.spi.AnnotatedInfo info,
                                    org.jboss.metadata.spi.MetaData retrieval,
                                    U handle)
                             throws Throwable
Apply plugin.

Parameters:
plugin - the plugin
info - the bean info
retrieval - the metadata
handle - the handle
Throws:
Throwable - for any error

cleanPlugin

protected abstract void cleanPlugin(T plugin,
                                    org.jboss.reflect.spi.AnnotatedInfo info,
                                    org.jboss.metadata.spi.MetaData retrieval,
                                    U handle)
                             throws Throwable
Clean plugin.

Parameters:
plugin - the plugin
info - the bean info
retrieval - the metadata
handle - the handle
Throws:
Throwable - for any error

getName

protected abstract Object getName(U handle)
Get the name from handle.

Parameters:
handle - the handle
Returns:
handle's name

getPlugins

protected Iterable<T> getPlugins(ElementType type,
                                 org.jboss.kernel.plugins.annotations.AnnotationPluginFilter filter,
                                 Collection<Class<? extends Annotation>> annotationClasses)
Get plugins.

Parameters:
type - the element type to match
filter - possible plugins filter
annotationClasses - possible annotations
Returns:
iterable matching plugins

handleAnnotations

protected void handleAnnotations(org.jboss.beans.info.spi.BeanInfo info,
                                 org.jboss.metadata.spi.MetaData retrieval,
                                 U handle,
                                 boolean isApplyPhase)
                          throws Throwable
Handle apply or cleanup of annotations.

Parameters:
info - the bean info
retrieval - the metadata
handle - the handle to use in a plugin
isApplyPhase - is this apply phase
Throws:
Throwable - for any error

handleMethod

protected void handleMethod(org.jboss.metadata.spi.MetaData retrieval,
                            U handle,
                            boolean isApplyPhase,
                            boolean trace,
                            Set<org.jboss.reflect.spi.MethodInfo> visitedMethods,
                            org.jboss.beans.info.spi.PropertyInfo pi,
                            org.jboss.reflect.spi.MethodInfo method,
                            String type,
                            Collection<Class<? extends Annotation>> annotationClasses)
                     throws Throwable
Handle setter or getter on property.

Parameters:
retrieval - the metadata
handle - the handle
isApplyPhase - is apply phase
trace - is trace enabled
visitedMethods - visited methods
pi - the property info
method - the method info
type - method type
annotationClasses - the possible annotation classes
Throws:
Throwable - for any error

getStaticMethods

protected org.jboss.reflect.spi.MethodInfo[] getStaticMethods(org.jboss.reflect.spi.ClassInfo classInfo)
Get the static methods of class info.

Parameters:
classInfo - the class info
Returns:
the static methods


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.