TUM CCSM Commons

edu.tum.cs.commons.reflect
Class FormalParameter

java.lang.Object
  extended by edu.tum.cs.commons.reflect.FormalParameter

public final class FormalParameter
extends java.lang.Object

This class models formal method parameters to allow convenient reflective access as the Java Reflection API does not model them explicitly. Instances of this class can be obtained via ReflectionUtils.getFormalParameters(Method).

Version:
$Rev: 26283 $
Author:
Florian Deissenboeck, $Author: juergens $
See Also:
ReflectionUtils.getFormalParameters(Method), ReflectionUtils.invoke(Method, Object, java.util.Map)
Rating:
GREEN Hash: 2D347E77304012F77E6CE9EA946F3982

Method Summary
 boolean equals(java.lang.Object object)
          Two formal parameters are equal if their declaring methods and their position within the formal parameter list are equal.
<A extends java.lang.annotation.Annotation>
A
getAnnotation(java.lang.Class<A> annotationClass)
          Returns this element's annotation for the specified type if such an annotation is present, else null.
 java.lang.annotation.Annotation[] getAnnotations()
          Get parameter annotations.
 java.lang.reflect.Type getGenericType()
          Get generic parameter type.
 java.lang.reflect.Method getMethod()
          Get the method that declares this formal parameter.
 int getPosition()
          Get the position of the formal parameter within the methods parameter list.
 java.lang.Class<?> getType()
          Get parameter type.
 int hashCode()
          The hashcode is computed as the exclusive-or of the method's hashcode and (position+1).
 boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns true if an annotation of the specified type is defined for this formal parameter.
 java.lang.String toString()
          Returns method name, position and type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getMethod

public java.lang.reflect.Method getMethod()
Get the method that declares this formal parameter.


getType

public java.lang.Class<?> getType()
Get parameter type.


getGenericType

public java.lang.reflect.Type getGenericType()
Get generic parameter type.


getAnnotations

public java.lang.annotation.Annotation[] getAnnotations()
Get parameter annotations.


getPosition

public int getPosition()
Get the position of the formal parameter within the methods parameter list.


hashCode

public int hashCode()
The hashcode is computed as the exclusive-or of the method's hashcode and (position+1).

Overrides:
hashCode in class java.lang.Object

getAnnotation

public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> annotationClass)
Returns this element's annotation for the specified type if such an annotation is present, else null.


isAnnotationPresent

public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns true if an annotation of the specified type is defined for this formal parameter.


equals

public boolean equals(java.lang.Object object)
Two formal parameters are equal if their declaring methods and their position within the formal parameter list are equal.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns method name, position and type.

Overrides:
toString in class java.lang.Object

TUM CCSM Commons

TUM CCSM Commons - 2.7