Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.lang
Class Reflection.Method

    java.lang.Object
      javolution.lang.Reflection.Method

Enclosing class:
  Reflection

    public abstract static class Reflection.Method

extends java.lang.Object

This class represents a run-time method obtained through reflection. Here are few examples of utilization:``

     // Non-static method: fastMap.put(myKey, myValue)
     Reflection.Method putKeyValue
         = Reflection.getMethod(
             "javolution.util.FastMap.put(java.lang.Object, java.lang.Object)");
     Object previous = putKeyValue.invoke(fastMap, myKey, myValue);

     // Static method: System.nanoTime()  (JRE1.5+)
     Reflection.Method nanoTime
         = Reflection.getMethod("java.lang.System.nanoTime()");
     long time = ((Long)nanoTime.invoke(null)).longValue();

Constructor Summary
`protected` | `Reflection.Method(java.lang.Class[] parameterTypes)` Creates a new constructor having the specified parameter types.

Method Summary
`protected abstract java.lang.Object` | `execute(java.lang.Object thisObject, java.lang.Object[] args)` Executes this method with the specified arguments.
`java.lang.Class[]` | `getParameterTypes()` Returns an array of `Class` objects that represents the formal parameter types, in declaration order of this constructor.
`java.lang.Object` | `invoke(java.lang.Object thisObject)` Invokes this method on the specified object which might be `null` if the method is static (convenience method).
`java.lang.Object` | `invoke(java.lang.Object thisObject, java.lang.Object arg0)` Invokes this method with the specified single argument on the specified object which might be `null` if the method is static (convenience method).
`java.lang.Object` | `invoke(java.lang.Object thisObject, java.lang.Object arg0, java.lang.Object arg1)` Invokes this method with the specified two arguments on the specified object which might be `null` if the method is static (convenience method).
`java.lang.Object` | `invoke(java.lang.Object thisObject, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)` Invokes this method with the specified three arguments on the specified object which might be `null` if the method is static.
`java.lang.Object` | `invoke(java.lang.Object thisObject, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)` Invokes this method with the specified four arguments on the specified object which might be `null` if the method is static (convenience method).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Reflection.Method

    protected Reflection.Method(java.lang.Class[] parameterTypes)

  Creates a new constructor having the specified parameter types.

  Parameters:
    `parameterTypes` - the parameters types.

Method Detail

### getParameterTypes

    public java.lang.Class[] getParameterTypes()

  Returns an array of `Class` objects that represents the formal parameter types, in declaration order of this constructor.

  Returns:
    the parameter types for this constructor.

### execute

    protected abstract java.lang.Object execute(java.lang.Object thisObject,
                                                java.lang.Object[] args)

  Executes this method with the specified arguments.

  Parameters:
    `thisObject` - the object upon which this method is invoked or `null` for static methods.
    `args` - the method arguments.
  Returns:
    the result of the execution.

### invoke

    public final java.lang.Object invoke(java.lang.Object thisObject)

  Invokes this method on the specified object which might be `null` if the method is static (convenience method).

  Parameters:
    `thisObject` - the object upon which this method is invoked or `null` for static methods.
  Returns:
    the result of the invocation.

### invoke

    public final java.lang.Object invoke(java.lang.Object thisObject,
                                         java.lang.Object arg0)

  Invokes this method with the specified single argument on the specified object which might be `null` if the method is static (convenience method).

  Parameters:
    `thisObject` - the object upon which this method is invoked or `null` for static methods.
    `arg0` - the single argument.
  Returns:
    the result of the invocation.

### invoke

    public final java.lang.Object invoke(java.lang.Object thisObject,
                                         java.lang.Object arg0,
                                         java.lang.Object arg1)

  Invokes this method with the specified two arguments on the specified object which might be `null` if the method is static (convenience method).

  Parameters:
    `thisObject` - the object upon which this method is invoked or `null` for static methods.
    `arg0` - the first argument.
    `arg1` - the second argument.
  Returns:
    the result of the invocation.
  Throws:
    `java.lang.RuntimeException` - wrapping any exception raised during invocation (see `Throwable.getCause()`).

### invoke

    public final java.lang.Object invoke(java.lang.Object thisObject,
                                         java.lang.Object arg0,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2)

  Invokes this method with the specified three arguments on the specified object which might be `null` if the method is static.

  Parameters:
    `thisObject` - the object upon which this method is invoked or `null` for static methods.
    `arg0` - the first argument (convenience method).
    `arg1` - the second argument.
    `arg2` - the third argument.
  Returns:
    the result of the invocation.

### invoke

    public final java.lang.Object invoke(java.lang.Object thisObject,
                                         java.lang.Object arg0,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2,
                                         java.lang.Object arg3)

  Invokes this method with the specified four arguments on the specified object which might be `null` if the method is static (convenience method).

  Parameters:
    `thisObject` - the object upon which this method is invoked or `null` for static methods.
    `arg0` - the first argument.
    `arg1` - the second argument.
    `arg2` - the third argument.
    `arg3` - the fourth argument.
  Returns:
    the result of the invocation.

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2007 Javolution.