fr.umlv.corosol.component.impl
Class DefaultJMethod

java.lang.Object
  extended by fr.umlv.corosol.component.impl.DefaultJMethod
All Implemented Interfaces:
JClassMethod, JMethod, JObject

public class DefaultJMethod
extends java.lang.Object
implements JMethod

This is the default implementation of the JMethod interface.

Author:
Christophe Deleray

Constructor Summary
DefaultJMethod(JClass declaringClass, JClassMember methodInfo)
          Creates a new DefaultJMethod object initialized with the specified class file item that containing the method datas and with the specified declaring class.
 
Method Summary
 byte[] getBytecode()
          Returns an array of bytes containg the byte code of the method represented by this JMethod object.
 JClass getDeclaringClass()
          Returns the JClass object representing the class or interface that declares the method represented by this JMethod object.
 java.lang.String getDescriptor()
          Returns the descriptor of the method represented by this JMethod object, as a String.
 JClass[] getExceptionTypes()
          Returns an array of JClass objects that represent the types of the exceptions declared to be thrown by the underlying method represented by this JMethod object.
 int getMaxLocals()
          Returns the number of local variables in the local variable array allocated upon invocation of this method, including the local variables used to pass parameters to this method on its invocation.
 int getMaxStack()
          Returns the maximum depth of the operand stack of a frame at any point during execution of this method.
 int getModifiers()
          Returns the Java language modifiers for the method represented by this JMethod object, as an integer.
 java.lang.String getName()
          Returns the name of the method represented by this JMethod object, as a String.
 java.lang.reflect.Method getNativeMethod()
          Returns the java.lang.reflect.Method object equivalent to this JMethod object.
 JClass[] getParameterTypes()
          Returns an array of JClass objects that represent the formal parameter types, in declaration order, of the method represented by this JMethod object.
 JClass getReturnType()
          Returns a JClass object that represents the formal return type of the method represented by this JMethod object.
 void invoke(JMethodInvoker invoker, JThread thread)
          Invokes the methods represented by this JClassMethod via the specified method invoker and into the specified thread.
 boolean isAbstract()
          Determines if the method specified by this JMethod object is abstract.
 boolean isNative()
          Determines if the method specified by this JMethod object is native.
 boolean isStatic()
          Determines if the method specified by this JMethod object is static.
 java.lang.String toString()
          Returns a string describing this JMethod.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultJMethod

public DefaultJMethod(JClass declaringClass,
                      JClassMember methodInfo)
Creates a new DefaultJMethod object initialized with the specified class file item that containing the method datas and with the specified declaring class.

Parameters:
declaringClass - the class declaring the method
methodInfo - the class file item containing the method datas
Method Detail

getNativeMethod

public java.lang.reflect.Method getNativeMethod()
Returns the java.lang.reflect.Method object equivalent to this JMethod object.

Specified by:
getNativeMethod in interface JMethod
Returns:
the java.lang.reflect.Method object equivalent to this JMethod object
See Also:
Method

getDeclaringClass

public JClass getDeclaringClass()
Returns the JClass object representing the class or interface that declares the method represented by this JMethod object.

Specified by:
getDeclaringClass in interface JClassMethod

getName

public java.lang.String getName()
Returns the name of the method represented by this JMethod object, as a String.

Specified by:
getName in interface JClassMethod

getModifiers

public int getModifiers()
Returns the Java language modifiers for the method represented by this JMethod object, as an integer. The Modifier class should be used to decode the modifiers.

Specified by:
getModifiers in interface JClassMethod
See Also:
Modifier

getDescriptor

public java.lang.String getDescriptor()
Returns the descriptor of the method represented by this JMethod object, as a String.

Specified by:
getDescriptor in interface JClassMethod

getReturnType

public JClass getReturnType()
Returns a JClass object that represents the formal return type of the method represented by this JMethod object.

Specified by:
getReturnType in interface JMethod
Returns:
the return type for the method this object represents

getParameterTypes

public JClass[] getParameterTypes()
Returns an array of JClass objects that represent the formal parameter types, in declaration order, of the method represented by this JMethod object. Returns an array of length 0 if the underlying method takes no parameters.

Specified by:
getParameterTypes in interface JClassMethod
Returns:
the parameter types for the method this object represents

getExceptionTypes

public JClass[] getExceptionTypes()
Returns an array of JClass objects that represent the types of the exceptions declared to be thrown by the underlying method represented by this JMethod object. Returns an array of length 0 if the method declares no exceptions in its throws clause.

Specified by:
getExceptionTypes in interface JClassMethod
Returns:
the exception types declared as being thrown by the method this object represents

getBytecode

public byte[] getBytecode()
Returns an array of bytes containg the byte code of the method represented by this JMethod object.

Specified by:
getBytecode in interface JClassMethod
Returns:
the byte code of the method

getMaxStack

public int getMaxStack()
Returns the maximum depth of the operand stack of a frame at any point during execution of this method.

Specified by:
getMaxStack in interface JClassMethod

getMaxLocals

public int getMaxLocals()
Returns the number of local variables in the local variable array allocated upon invocation of this method, including the local variables used to pass parameters to this method on its invocation.

Specified by:
getMaxLocals in interface JClassMethod

isStatic

public boolean isStatic()
Determines if the method specified by this JMethod object is static.

Specified by:
isStatic in interface JMethod
Returns:
true if and only if this method is static; false otherwise.

isAbstract

public boolean isAbstract()
Determines if the method specified by this JMethod object is abstract.

Specified by:
isAbstract in interface JMethod
Returns:
true if and only if this method is abstract; false otherwise.

isNative

public boolean isNative()
Determines if the method specified by this JMethod object is native.

Specified by:
isNative in interface JMethod
Returns:
true if and only if this method is native; false otherwise.

invoke

public void invoke(JMethodInvoker invoker,
                   JThread thread)
            throws java.lang.Exception
Invokes the methods represented by this JClassMethod via the specified method invoker and into the specified thread.

Specified by:
invoke in interface JClassMethod
Parameters:
invoker - a method invoker
thread - the thread into which the method will be executed
Throws:
java.lang.Exception - if the executed method throws an exception

toString

public java.lang.String toString()
Returns a string describing this JMethod.

Overrides:
toString in class java.lang.Object