com.tensegrity.generic.util
Class ReflectUtilities

java.lang.Object
  extended bycom.tensegrity.generic.util.ReflectUtilities

public final class ReflectUtilities
extends java.lang.Object

Class Objects is a collection of small helper methods concerning "integral type to Object" conversions and dynamic method invocation. Basically this class was added for beautification purpose: By using Objects.get(integraltype) you can avoid code lines like this: Double d = new Double(myIntegralDouble).

Version:
$Id: ReflectUtilities.java,v 1.4 2004/10/11 10:31:11 MichaelKegel Exp $
Author:
Gilles Iachelini

Method Summary
static java.lang.Object invoke(java.lang.Object object, java.lang.String methodName)
          Invokes a class’s public instance method methodName, passing no arguments.
static java.lang.Object invoke(java.lang.Object object, java.lang.String methodName, java.lang.Class[] classes, java.lang.Object[] args)
          Invokes a class’s public instance method, passing zero or more arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

invoke

public static final java.lang.Object invoke(java.lang.Object object,
                                            java.lang.String methodName)
Invokes a class’s public instance method methodName, passing no arguments.

Parameters:
object - the object to invoke the method on.
methodName - the name of the method to be called.
Returns:
the returned value.

invoke

public static final java.lang.Object invoke(java.lang.Object object,
                                            java.lang.String methodName,
                                            java.lang.Class[] classes,
                                            java.lang.Object[] args)
Invokes a class’s public instance method, passing zero or more arguments.

An example:

 Objects.invoke(
    someComponent, 
    "setText", 
    new Class[] { String.class },
    new Object[] { "newText" });
 

Parameters:
object - the object to invoke the method on.
methodName - the name of the method.
classes - the array of argument types aka. argument classes.
args - the array of arguments.
Returns:
the returned value from this method (if any).


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.