wt.adapter.attribute
Class ReflectionHelper
java.lang.Object
wt.adapter.attribute.ReflectionHelper
- public class ReflectionHelper
- extends Object
ReflectionHelper contains methods to obtain the method used to get a specified attribute value for a class.
The class caches information obtained through reflection techniques,
storing the information in a two-level cache.
Field Summary |
private static Hashtable |
h
This hashtable is used for the two-level caching. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
h
private static Hashtable h
- This hashtable is used for the two-level caching.
The key into this hashtable is the class of the object.
The key is used to obtain another hashtable, which holds the methods associated with attribute names.
ReflectionHelper
public ReflectionHelper()
getReadMethod
public static Method getReadMethod(Class c,
String attributeName)
throws NoSuchMethodException
- Obtain the "getter" method used to get the value for the specified attribute from the
specified class.
This method uses standard Java reflection instead of Windchill Introspection for
performance.
- Parameters:
c
- the class of the objectattributeName
- the name of the attribute to obtain the getter method
- Throws:
NoSuchMethodException
convertAttributeNameToMethodName
private static String convertAttributeNameToMethodName(String attributeName,
boolean tryIs)
- Convert the attributeName to a possible method name. The attribute name will be converted to
"getXXX" or "isXXX".
- Parameters:
attributeName
- the name of the attributetryIs
- if true, convert to isXXX, else convert to getXXX