net.sf.twip.util
Class Parameter

java.lang.Object
  extended by net.sf.twip.util.Parameter

public abstract class Parameter
extends Object

In java.lang.reflect the parameters are not first class citizens: you can only access them by several index methods, and the name is not kept in the class file. This class tries to fill that gap as good as it goes.


Field Summary
protected  int index
           
 
Constructor Summary
Parameter(int index)
           
 
Method Summary
<T extends Annotation>
T
getAnnotation(Class<T> annotationType)
           
abstract  Annotation[] getAnnotations()
           
 int getIndex()
           
abstract  Method getMethod()
           
abstract  Class<?> getType()
           
<T extends Annotation>
boolean
isAnnotationPresent(Class<T> annotationType)
           
 boolean isCallable(Object value)
          Can that value be passed as this parameter? I.e.
static List<Parameter> of(Constructor<?> constructor)
           
static List<Parameter> of(Method method)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

protected final int index
Constructor Detail

Parameter

public Parameter(int index)
Method Detail

of

public static List<Parameter> of(Method method)

of

public static List<Parameter> of(Constructor<?> constructor)

getIndex

public int getIndex()

getAnnotation

public <T extends Annotation> T getAnnotation(Class<T> annotationType)
Returns:
the annotation of that type or null if the parameter is not annotated with that type.

getAnnotations

public abstract Annotation[] getAnnotations()

getType

public abstract Class<?> getType()

getMethod

public abstract Method getMethod()

isAnnotationPresent

public <T extends Annotation> boolean isAnnotationPresent(Class<T> annotationType)

isCallable

public boolean isCallable(Object value)
Can that value be passed as this parameter? I.e. is it an instance of the correct type or (if it's not really primitive) null; correctly handles primitive types where Class.isInstance(Object) returns false for.


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.