wt.adapter.attribute
Class ReflectionHelper

java.lang.Object
  extended bywt.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.
 
Constructor Summary
ReflectionHelper()
           
 
Method Summary
private static String convertAttributeNameToMethodName(String attributeName, boolean tryIs)
          Convert the attributeName to a possible method name.
static Method getReadMethod(Class c, String attributeName)
          Obtain the "getter" method used to get the value for the specified attribute from the specified class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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.

Constructor Detail

ReflectionHelper

public ReflectionHelper()
Method Detail

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 object
attributeName - 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 attribute
tryIs - if true, convert to isXXX, else convert to getXXX