com.sas.edir.util
Class ReflectOp

java.lang.Object
  |
  +--com.sas.edir.util.ReflectOp

public class ReflectOp
extends java.lang.Object

The ReflectOp class contains static methods that are useful for doing reflection.


Constructor Summary
ReflectOp()
           
 
Method Summary
static java.lang.reflect.Constructor getConstructor(java.lang.Class from, java.lang.Object[] params)
          Returns a constructor that matches the specified signature.
static java.lang.reflect.Field getField(java.lang.Class from, java.lang.String fieldName)
           
static java.lang.Object getFieldValue(java.lang.Class from, java.lang.String fieldName)
           
static java.lang.reflect.Method getMethod(java.lang.Class from, java.lang.String methodName, java.lang.Object methodParameter)
          Returns a method that matches the specified signature.
static java.lang.reflect.Method getMethod(java.lang.Class from, java.lang.String methodName, java.lang.Object[] params)
          Returns a method that matches the specified signature.
static java.lang.reflect.Method getMethod(java.lang.Class from, java.lang.String methodName, java.util.Vector methodParameters)
          Returns a method that matches the specified signature.
static java.lang.String methodString(java.lang.Object obj, java.lang.Object methodName, java.lang.Object arg)
          Returns a string representation of the method.
static java.lang.String methodString(java.lang.Object obj, java.lang.Object methodName, java.lang.Object[] args)
          Returns a string representation of the method.
static java.lang.String methodString(java.lang.Object obj, java.lang.Object methodName, java.util.Vector args)
          Returns a string representation of the method.
static java.lang.Object newObject(java.lang.Class objectClass)
          Instantiates and returns an object.
static java.lang.Object newObject(java.lang.Class objectClass, java.lang.Object ctorArg)
          Instantiates and returns an object.
static java.lang.Object newObject(java.lang.Class objectClass, java.lang.Object[] ctorArgs)
          Instantiates and returns an object.
static java.lang.Object newObject(java.lang.String[] propArray)
          Instantiates and returns an object.
static java.lang.Object newObject(java.lang.String[] propArray, java.lang.Object ctorArg)
          Instantiates and returns an object.
static java.lang.Object newObject(java.lang.String[] propArray, java.lang.Object[] ctorArgs)
          Instantiates and returns an object.
static java.lang.Object runMethod(java.lang.Object from, java.lang.String methodName)
          Runs the specified method and returns the value returned by that method.
static java.lang.Object runMethod(java.lang.Object from, java.lang.String methodName, java.lang.Object methodParameter)
          Runs the specified method and returns the value returned by that method.
static java.lang.Object runMethod(java.lang.Object from, java.lang.String methodName, java.lang.Object[] params)
          Runs the specified method and returns the value returned by that method.
static java.lang.Object runMethod(java.lang.Object from, java.lang.String methodName, java.util.Vector methodParameters)
          Runs the specified method and returns the value returned by that method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectOp

public ReflectOp()
Method Detail

newObject

public static final java.lang.Object newObject(java.lang.Class objectClass)
                                        throws ReflectionException
Instantiates and returns an object.

Parameters:
objectClass - The objects class.
Throws:
ReflectionException - Thrown on object instantiation failure.

newObject

public static final java.lang.Object newObject(java.lang.Class objectClass,
                                               java.lang.Object ctorArg)
                                        throws ReflectionException
Instantiates and returns an object.

Parameters:
objectClass - The objects class.
ctorArg - An argument to pass to the constructor.
Throws:
ReflectionException - Thrown on object instantiation failure.

newObject

public static final java.lang.Object newObject(java.lang.Class objectClass,
                                               java.lang.Object[] ctorArgs)
                                        throws ReflectionException
Instantiates and returns an object.

Parameters:
objectClass - The objects class.
ctorArgs - The arguments to pass to the constructor.
Throws:
ReflectionException - Thrown on object instantiation failure.

newObject

public static final java.lang.Object newObject(java.lang.String[] propArray)
                                        throws ReflectionException
Instantiates and returns an object.

Parameters:
propArray - The properties array.
Throws:
ReflectionException - Thrown on object instantiation failure.

newObject

public static final java.lang.Object newObject(java.lang.String[] propArray,
                                               java.lang.Object ctorArg)
                                        throws ReflectionException
Instantiates and returns an object.

Parameters:
propArray - The properties array.
ctorArg - An argument to pass to the constructor.
Throws:
ReflectionException - Thrown on object instantiation failure.

newObject

public static final java.lang.Object newObject(java.lang.String[] propArray,
                                               java.lang.Object[] ctorArgs)
                                        throws ReflectionException
Instantiates and returns an object.

Parameters:
propArray - The properties array.
ctorArgs - The arguments to pass to the constructor.
Throws:
ReflectionException - Thrown on object instantiation failure.

getConstructor

public static final java.lang.reflect.Constructor getConstructor(java.lang.Class from,
                                                                 java.lang.Object[] params)
                                                          throws java.lang.ClassNotFoundException
Returns a constructor that matches the specified signature.

Parameters:
from - The class from which we are getting the constructor.
params - The constructor parameters.
Returns:
The constructor.
Throws:
java.lang.ClassNotFoundException - If the class can not be found.

getFieldValue

public static final java.lang.Object getFieldValue(java.lang.Class from,
                                                   java.lang.String fieldName)
                                            throws ReflectionException

getField

public static final java.lang.reflect.Field getField(java.lang.Class from,
                                                     java.lang.String fieldName)
                                              throws java.lang.ClassNotFoundException

getMethod

public static final java.lang.reflect.Method getMethod(java.lang.Class from,
                                                       java.lang.String methodName,
                                                       java.lang.Object methodParameter)
                                                throws java.lang.ClassNotFoundException
Returns a method that matches the specified signature.

Parameters:
from - The class from which we are getting the method.
methodName - The method name.
methodParameter - The method parameter.
Returns:
The method.
Throws:
java.lang.ClassNotFoundException - If the class can not be found.

getMethod

public static final java.lang.reflect.Method getMethod(java.lang.Class from,
                                                       java.lang.String methodName,
                                                       java.util.Vector methodParameters)
                                                throws java.lang.ClassNotFoundException
Returns a method that matches the specified signature.

Parameters:
from - The class from which we are getting the method.
methodName - The method name.
methodParameters - The method parameters.
Returns:
The method.
Throws:
java.lang.ClassNotFoundException - If the class can not be found.

getMethod

public static final java.lang.reflect.Method getMethod(java.lang.Class from,
                                                       java.lang.String methodName,
                                                       java.lang.Object[] params)
                                                throws java.lang.ClassNotFoundException
Returns a method that matches the specified signature.

Parameters:
from - The class from which we are getting the method.
methodName - The method name.
params - The method parameters.
Returns:
The method.
Throws:
java.lang.ClassNotFoundException - If the class can not be found.

runMethod

public static final java.lang.Object runMethod(java.lang.Object from,
                                               java.lang.String methodName)
                                        throws ReflectionException
Runs the specified method and returns the value returned by that method.

Parameters:
from - The class from which we are getting the method.
methodName - The method name.
Returns:
The value returned by the method.
Throws:
ReflectionException - Thrown if an exception occurs running the method.

runMethod

public static final java.lang.Object runMethod(java.lang.Object from,
                                               java.lang.String methodName,
                                               java.lang.Object methodParameter)
                                        throws ReflectionException
Runs the specified method and returns the value returned by that method.

Parameters:
from - The class from which we are getting the method.
methodName - The method name.
methodParameter - The method parameter.
Returns:
The value returned by the method.
Throws:
ReflectionException - Thrown if an exception occurs running the method.

runMethod

public static final java.lang.Object runMethod(java.lang.Object from,
                                               java.lang.String methodName,
                                               java.util.Vector methodParameters)
                                        throws ReflectionException
Runs the specified method and returns the value returned by that method.

Parameters:
from - The class from which we are getting the method.
methodName - The method name.
methodParameters - The method parameters.
Returns:
The value returned by the method.
Throws:
ReflectionException - Thrown if an exception occurs running the method.

runMethod

public static final java.lang.Object runMethod(java.lang.Object from,
                                               java.lang.String methodName,
                                               java.lang.Object[] params)
                                        throws ReflectionException
Runs the specified method and returns the value returned by that method.

Parameters:
from - The class from which we are getting the method.
methodName - The method name.
methodParameters - The method parameters.
Returns:
The value returned by the method.
Throws:
ReflectionException - Thrown if an exception occurs running the method.

methodString

public static final java.lang.String methodString(java.lang.Object obj,
                                                  java.lang.Object methodName,
                                                  java.lang.Object arg)
Returns a string representation of the method.

Parameters:
obj - The object containing the method.
methodName - The method name.
arg - The method argument.
Returns:
The string representation.

methodString

public static final java.lang.String methodString(java.lang.Object obj,
                                                  java.lang.Object methodName,
                                                  java.util.Vector args)
Returns a string representation of the method.

Parameters:
obj - The object containing the method.
methodName - The method name.
args - The method arguments.
Returns:
The string representation.

methodString

public static final java.lang.String methodString(java.lang.Object obj,
                                                  java.lang.Object methodName,
                                                  java.lang.Object[] args)
Returns a string representation of the method.

Parameters:
obj - The object containing the method.
methodName - The method name.
args - The method arguments.
Returns:
The string representation.