org.apache.jdo.impl.model.java.reflection
Class ReflectionJavaMethod

java.lang.Object
  extended byorg.apache.jdo.impl.model.java.AbstractJavaMember
      extended byorg.apache.jdo.impl.model.java.reflection.ReflectionJavaMethod
All Implemented Interfaces:
JavaElement, JavaMember, JavaMethod

public class ReflectionJavaMethod
extends AbstractJavaMember
implements JavaMethod

A reflection based JavaMethod implementation. The implementation takes java.lang.reflect.Method instances to get Java related metadata about methods.

Since:
JDO 2.0
Author:
Michael Bouschen

Field Summary
private  java.lang.reflect.Method method
          The wrapped java.lang.reflect.Method instance.
 
Fields inherited from class org.apache.jdo.impl.model.java.AbstractJavaMember
 
Constructor Summary
ReflectionJavaMethod(java.lang.reflect.Method method, JavaType declaringClass)
          Constructor.
 
Method Summary
 JavaType getJavaTypeForClass(java.lang.Class clazz)
          Returns a JavaType instance for the specified Class object.
 int getModifiers()
          Returns the Java language modifiers for the field represented by this JavaMember, as an integer.
 JavaType[] getParameterTypes()
          Returns an array of JavaType instances that represent the formal parameter types, in declaration order, of the method represented by this JavaMethod instance.
 JavaType getReturnType()
          Returns the JavaType representation of the method return type.
 JavaType getType()
          Returns the JavaType representation of the type of the member.
 java.lang.Object getUnderlyingObject()
          Returns the environment specific instance wrapped by this JavaModel element.
 
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaMember
equals, getComponentType, getDeclaringClass, getName, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jdo.model.java.JavaMember
getComponentType, getDeclaringClass, getName
 

Field Detail

method

private final java.lang.reflect.Method method
The wrapped java.lang.reflect.Method instance.

Constructor Detail

ReflectionJavaMethod

public ReflectionJavaMethod(java.lang.reflect.Method method,
                            JavaType declaringClass)
Constructor.

Parameters:
method - the reflection method representation.
declaringClass - the JavaType of the class that declares the field.
Method Detail

getUnderlyingObject

public java.lang.Object getUnderlyingObject()
Returns the environment specific instance wrapped by this JavaModel element. This implementation returns the java.lang.reflect.Method instance for this JavaMethod.

Specified by:
getUnderlyingObject in interface JavaElement
Returns:
the environment specific instance wrapped by this JavaModel element.

getModifiers

public int getModifiers()
Returns the Java language modifiers for the field represented by this JavaMember, as an integer. The java.lang.reflect.Modifier class should be used to decode the modifiers.

Specified by:
getModifiers in interface JavaMember
Specified by:
getModifiers in class AbstractJavaMember
Returns:
the Java language modifiers for this JavaMember
See Also:
Modifier

getType

public JavaType getType()
Description copied from interface: JavaMember
Returns the JavaType representation of the type of the member.

Specified by:
getType in interface JavaMember
Specified by:
getType in class AbstractJavaMember
Returns:
type of the member

getReturnType

public JavaType getReturnType()
Returns the JavaType representation of the method return type.

Specified by:
getReturnType in interface JavaMethod
Returns:
method return type.

getParameterTypes

public JavaType[] getParameterTypes()
Returns an array of JavaType instances that represent the formal parameter types, in declaration order, of the method represented by this JavaMethod instance.

Specified by:
getParameterTypes in interface JavaMethod
Returns:
the types of teh formal parameters.

getJavaTypeForClass

public JavaType getJavaTypeForClass(java.lang.Class clazz)
Returns a JavaType instance for the specified Class object. This method provides a hook such that ReflectionJavaField subclasses can implement their own mapping of Class objects to JavaType instances.