com.fatwire.gst.foundation.controller.annotation
Class AnnotationUtils

java.lang.Object
  extended by com.fatwire.gst.foundation.controller.annotation.AnnotationUtils

public final class AnnotationUtils
extends Object

Helper class to work with Annotations.

Since:
May 27, 2011
Author:
Dolf Dijkstra

Method Summary
static
<T> Field
findField(Object a, Class<T> type)
          Searches the object for a field annotated with the InjectForRequest annotation of the provided type.
static
<T> T
findService(Object object, Class<T> type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findService

public static <T> T findService(Object object,
                                Class<T> type)
Type Parameters:
T - the class of the object that is returned .
Parameters:
object - the object containing the object to find.
type - the Class of the type that is searched for.
Returns:
the object that is present on the field with the InjectForRequest annotation.

findField

public static <T> Field findField(Object a,
                                  Class<T> type)
Searches the object for a field annotated with the InjectForRequest annotation of the provided type.

For instance @InjectForRequest Service service; is defined on the class as a field, then findField(object,Service.class); will return the Field service.

Type Parameters:
T - the type of the field to look for.
Parameters:
a - the object to search on for the typed field.
type -
Returns:
the class field with the InjectForRequest annotation of the Class type.


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