com.fatwire.gst.foundation.controller.action
Class AnnotationInjector

java.lang.Object
  extended by com.fatwire.gst.foundation.controller.action.AnnotationInjector

public final class AnnotationInjector
extends Object

Helper to inject dependencies into Object based on annotated fields and methods.

Since:
Mar 26, 2011
Author:
Dolf Dijkstra

Field Summary
protected static org.apache.commons.logging.Log LOG
           
protected static org.apache.commons.logging.Log LOG_TIME
           
 
Constructor Summary
AnnotationInjector()
           
 
Method Summary
static Field[] findFieldsWithAnnotation(Object object, Class<? extends Annotation> annnotationClass)
          Finds the fields in the class or super class that are annotated with the annnotationClass annotation.
static void inject(Object object, Factory factory)
          Inject ICS runtime objects into the object.
static void injectIntoField(Object object, Factory factory, Field field)
           
static void injectIntoMethod(Object object, Factory factory, Method method)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG

LOG_TIME

protected static final org.apache.commons.logging.Log LOG_TIME
Constructor Detail

AnnotationInjector

public AnnotationInjector()
Method Detail

inject

public static final void inject(Object object,
                                Factory factory)
Inject ICS runtime objects into the object. Objects flagged with the InjectForRequest annotation will be populated by this method by retrieving the value from the Factory.getObject(String,Class) method.

Parameters:
object - the object to inject into
factory - the factory that created the objects that need to be injected.

findFieldsWithAnnotation

public static final Field[] findFieldsWithAnnotation(Object object,
                                                     Class<? extends Annotation> annnotationClass)
Finds the fields in the class or super class that are annotated with the annnotationClass annotation.

Parameters:
object - the object to inspect.
annnotationClass - the annotation to find.
Returns:
the array of fields with the annotation, never null.

injectIntoField

public static void injectIntoField(Object object,
                                   Factory factory,
                                   Field field)
                            throws SecurityException
Parameters:
object -
factory -
field -
Throws:
SecurityException

injectIntoMethod

public static void injectIntoMethod(Object object,
                                    Factory factory,
                                    Method method)
                             throws SecurityException
Parameters:
object -
factory -
method -
Throws:
SecurityException


Copyright © 2010-2013 Oracle Corporation. All Rights Reserved.