| java.lang.Object com.nabhinc.util.ReflectionUtil
ReflectionUtil | public class ReflectionUtil (Code) | | author: Padmanabh Dabke author: (c) 2003 Nabh Information Systems, Inc. All Rights Reserved. |
Method Summary | |
public static Method | findGetMethod(Class cl, String name) | public static Method | findSetMethod(Class cl, String name) | public static Method | getMethod(Object target, String name, Object[] params) | public static Object | getProperty(Object target, String propName) | public static Class | getPropertyType(Object target, String propName) | public static String[] | hashtableToStrings(Hashtable table) Ad-hoc serialization of a hashtable as a string array. | public static boolean | matches(Class[] parms, Object[] args) | public static void | setObjectProperty(Object target, String name, Object value, boolean strict) Attempts to look up a field or a "setXXX" method on the target object and
use it to set specified property. | public static void | setProperty(Object target, String name, String value, boolean strict) Attempts to look up a field or a "setXXX" method on the target object and
use it to set specified property. | public static void | setProperty(Object target, Method propSetter, int propertyType, PortletRequest req, String paramName) | public static Hashtable | stringsToHashtable(String[] strings) A hashtable deserialization method corresponding to
hashtableToStrings. |
getMethod | public static Method getMethod(Object target, String name, Object[] params) throws Exception(Code) | | Attempts to find the Method object given the target object, method
name, and the parameters
Method invocation result Parameters: target - Target object Parameters: name - Method name exception: Exception - Thrown if the method cannot be found |
hashtableToStrings | public static String[] hashtableToStrings(Hashtable table)(Code) | | Ad-hoc serialization of a hashtable as a string array. Each
hashtable entry is converted into three strings: key name,
stringified object, class name of the object.
Parameters: table - Hashtable to be serialized Serialized hashtable |
matches | public static boolean matches(Class[] parms, Object[] args)(Code) | | Utility method used by getMethod to find out if the supplied
arguments array matches the type array
Parameters: parms - A class array representing a method signature Parameters: args - Argument array |
setProperty | public static void setProperty(Object target, String name, String value, boolean strict) throws IllegalAccessException, InvocationTargetException(Code) | | Attempts to look up a field or a "setXXX" method on the target object and
use it to set specified property. If the "strict" flag is true and
this method fails to match property name with a field/method, it throws
IllegalArgumentException . The value
is converted to an object of the appropriate class based on the field type.
Currently this method does not handle array or non-primitive properties.
Parameters: target - Target object Parameters: Property - name Parameters: String - specifying property value Parameters: strict - If true and a matching field/method is not found, this methodthrows IllegalAccessException. throws: InvocationTargetException - throws: IllegalAccessException - |
stringsToHashtable | public static Hashtable stringsToHashtable(String[] strings) throws ClassNotFoundException(Code) | | A hashtable deserialization method corresponding to
hashtableToStrings.
Parameters: strings - A string array containing serialized hashtable Deserialized hashtable |
|
|