net.yagga.util
Class MetaUt

java.lang.Object
  |
  +--net.yagga.util.MetaUt

public class MetaUt
extends java.lang.Object

Utilities for Meta classes, helper for Reflection and so on

Author:
Walter Gamba

Constructor Summary
MetaUt()
           
 
Method Summary
static java.lang.Object simpleInvokeMethod(java.lang.Class _class, java.lang.Object target, java.lang.String method, java.lang.Object[] args)
          Invokes a method of a given class and given object.
static java.lang.Object simpleInvokeMethod(java.lang.Class _class, java.lang.Object target, java.lang.String method, java.lang.Object[] args, boolean _static)
          Invokes a method of a given class and given object.
static java.lang.Object simpleInvokeStaticMethod(java.lang.Class _class, java.lang.String method, java.lang.Object[] args)
          Invokes a static method of a given class and given object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

MetaUt

public MetaUt()
Method Detail

simpleInvokeStaticMethod

public static java.lang.Object simpleInvokeStaticMethod(java.lang.Class _class,
                                                        java.lang.String method,
                                                        java.lang.Object[] args)
Invokes a static method of a given class and given object. The class must define this static method which takes any number of arguments and can return anything. No arrays if not of the appropraite type needed by the method, i.e. no conversion is attempted (example from array of String to array of Integers)
Please note that no overloading/polymorohism of methods is used. The first method that has the same name as the one passed, and the same number of arguments, is used.
And of course, "first" has no predictable meaning, so please be sure that you don't have ambiguities.
Parameters:
_class - an Object representing the Class of target
method - the name of the method to invoke
args - the arguments to the method of this class of the jar file, as Objects
Returns:
an Object containing the return value or values.
See Also:
for description

simpleInvokeMethod

public static java.lang.Object simpleInvokeMethod(java.lang.Class _class,
                                                  java.lang.Object target,
                                                  java.lang.String method,
                                                  java.lang.Object[] args)
Invokes a method of a given class and given object. By default non static methods can be invoked
See Also:
for description

simpleInvokeMethod

public static java.lang.Object simpleInvokeMethod(java.lang.Class _class,
                                                  java.lang.Object target,
                                                  java.lang.String method,
                                                  java.lang.Object[] args,
                                                  boolean _static)
Invokes a method of a given class and given object. The class must define this method which takes any number of arguments and can return anything. No arrays if not of the appropraite type needed by the method, i.e. no conversion is attempted (example from array of String to array of Integers)
Please note that no overloading/polymorohism of methods is used. The first method that has the same name as the one passed, and the same number of arguments, is used.
And of course, "first" has no predictable meaning, so please be sure that you don't have ambiguities.
Parameters:
_class - an Object representing the Class of target
target - the object on to which to invoke method. Can be null if method is static
method - the name of the method to invoke
args - the arguments to the method of this class of the jar file, as Object
_static - boolean. If true method MUST be static, else no check is made
Returns:
an Object containing th return value or values.