com.plumtree.openfoundation.reflect
Class XPReflect

java.lang.Object
  extended by com.plumtree.openfoundation.reflect.XPReflect

public class XPReflect
extends java.lang.Object

Helper class to access java.lang.reflect.Method.invoke() or System.Reflection.MethodInfo.Invoke() methods.

Author:
djc

Constructor Summary
XPReflect()
           
 
Method Summary
static java.lang.reflect.Method FindPublicMethod(java.lang.Object target, java.lang.String methodName, java.lang.Class actualParamType)
          Find a publicly declated method from the given target object.
static java.lang.Object InvokeGetMethod(java.lang.Object target, java.lang.String fieldName)
          Invoke a getMethod from target object.
static java.lang.Object InvokeMethod(java.lang.Object target, java.lang.String methodName)
          Invoke a method with no input parameters from target object.
static java.lang.Object InvokeMethod(java.lang.Object target, java.lang.String methodName, java.lang.Class[] paramTypes, java.lang.Object[] paramValues)
          Invoke a method with required parameters and corresponding types from target object.
static java.lang.Object InvokeMethod(java.lang.Object target, java.lang.String methodName, java.lang.Object paramOne)
          Invoke a method with one input parameters from target object.
static java.lang.Object InvokeMethod(java.lang.Object target, java.lang.String methodName, java.lang.Object[] paramValues)
          Invoke a method with required parameters from target object.
static java.lang.Object InvokePublicMethod(java.lang.Object target, java.lang.String methodName, java.lang.Object singleParam)
          Invoke a public method that requires only one parameter from target object.
static java.lang.Object InvokePublicMethodUnchecked(java.lang.Object target, java.lang.String methodName, java.lang.Object singleParam)
          Invoke a public method that requires only one parameter from target object.
static java.lang.Object InvokeSetMethod(java.lang.Object target, java.lang.String methodName, java.lang.Object paramOne)
          Invoke a setMethod from target object.
static java.lang.String ToInitCase(java.lang.String txt)
          Capitalize 1st character of input string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPReflect

public XPReflect()
Method Detail

FindPublicMethod

public static java.lang.reflect.Method FindPublicMethod(java.lang.Object target,
                                                        java.lang.String methodName,
                                                        java.lang.Class actualParamType)
Find a publicly declated method from the given target object.

Parameters:
target - the object the underlying method is invoked from
methodName - name of method to be invoked from the target object
actualParamType - the arguments used for the method call
Returns:
returned object of method invocation

InvokeMethod

public static java.lang.Object InvokeMethod(java.lang.Object target,
                                            java.lang.String methodName)
Invoke a method with no input parameters from target object.

Parameters:
target - the object the underlying method is invoked from
methodName - name of method to be invoked from the target object
Returns:
returned object of method invocation

InvokeMethod

public static java.lang.Object InvokeMethod(java.lang.Object target,
                                            java.lang.String methodName,
                                            java.lang.Object paramOne)
Invoke a method with one input parameters from target object.

Parameters:
target - the object the underlying method is invoked from
methodName - name of method to be invoked from the target object
paramOne - input object
Returns:
returned object of method invocation

InvokeSetMethod

public static java.lang.Object InvokeSetMethod(java.lang.Object target,
                                               java.lang.String methodName,
                                               java.lang.Object paramOne)
Invoke a setMethod from target object.

Parameters:
target - the object the underlying method is invoked from
methodName - field name to be assigned
paramOne - input object
Returns:
returned object of method invocation

InvokeMethod

public static java.lang.Object InvokeMethod(java.lang.Object target,
                                            java.lang.String methodName,
                                            java.lang.Object[] paramValues)
Invoke a method with required parameters from target object.

Parameters:
target - the object the underlying method is invoked from
methodName - name of setMethod to be invoked from the target object
paramValues - an object array for input parameters
Returns:
returned object of method invocation

InvokeMethod

public static java.lang.Object InvokeMethod(java.lang.Object target,
                                            java.lang.String methodName,
                                            java.lang.Class[] paramTypes,
                                            java.lang.Object[] paramValues)
Invoke a method with required parameters and corresponding types from target object.

Parameters:
target - the object the underlying method is invoked from
methodName - name of setMethod to be invoked from the target object
paramTypes - an array of corresponding data types of input objects
paramValues - an array of objects for method input parameters
Returns:
returned object of method invocation

InvokePublicMethod

public static java.lang.Object InvokePublicMethod(java.lang.Object target,
                                                  java.lang.String methodName,
                                                  java.lang.Object singleParam)
                                           throws java.lang.reflect.InvocationTargetException,
                                                  java.lang.IllegalAccessException
Invoke a public method that requires only one parameter from target object. This method will throw native InvocationTargetException and IllegalAccessException instead of their xdk counterparts.

Parameters:
target - the object the underlying method is invoked from
methodName - name of setMethod to be invoked from the target object
singleParam - input object
Returns:
returned object of method invocation
Throws:
java.lang.reflect.InvocationTargetException - if the underlying method throws an exception
java.lang.IllegalAccessException - if this Method object enforces Java language access control and the underlying method is inaccessible

InvokePublicMethodUnchecked

public static java.lang.Object InvokePublicMethodUnchecked(java.lang.Object target,
                                                           java.lang.String methodName,
                                                           java.lang.Object singleParam)
Invoke a public method that requires only one parameter from target object.

Parameters:
target - the object the underlying method is invoked from
methodName - name of the method to be invoked from the target object
singleParam - input object
Returns:
returned object of method invocation

InvokeGetMethod

public static java.lang.Object InvokeGetMethod(java.lang.Object target,
                                               java.lang.String fieldName)
Invoke a getMethod from target object.

Parameters:
target - the object the underlying method is invoked from
fieldName - field name to be retrieved
Returns:
returned object of method invocation

ToInitCase

public static java.lang.String ToInitCase(java.lang.String txt)
Capitalize 1st character of input string.

Parameters:
txt - input String object
Returns:
String with 1st character capitalized


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.