IBM Rational Functional Tester
Version 8.1.1000
IBM Rational Functional Tester Proxy SDK Reference

Project Version 2.3

com.rational.test.ft.domain.java
Class JavaBeanProperties

java.lang.Object   extended by com.rational.test.ft.domain.java.JavaBeanProperties

public class JavaBeanProperties
extends java.lang.Object

A helper class that provides access to java properties as defined by the java bean pattern.


Field Summary
protected static com.rational.test.ft.util.FtDebug debug
           
protected static int MAX_NUM_ARRAY_PROP
           
 
Constructor Summary
JavaBeanProperties()
           
 
Method Summary
protected static java.lang.reflect.Method accessorMethod(java.lang.String propertyName, java.lang.Class cls)
           
static void getAllProperties(java.lang.Object testObject, com.rational.test.ft.sys.HashtableEx properties, IPropertyFilter filter)
          Iterates across all the methods and validates that the method is public not-static.
protected static java.lang.reflect.Method getArrayMethod(java.lang.Class cls, java.lang.String name)
           
protected static java.lang.reflect.Method getMethod(java.lang.Class cls, java.lang.String name)
           
protected static java.lang.reflect.Method getNonArrayMethod(java.lang.Class cls, java.lang.String name)
           
static void getNonValueProperties(java.lang.Class cls, com.rational.test.ft.sys.HashtableEx properties, IPropertyFilter filter)
           
protected static java.lang.Class getObjectType(java.lang.Object value)
           
static java.lang.Object getProperty(java.lang.Object testObject, java.lang.String property)
          Fetches the specified property associated with the control being evaluated; registers it with the supplied object.
static java.lang.reflect.Method getSetMethodForNullProperty(java.lang.Class testObjectClass, java.lang.String propertyName)
          get the set method that can be used to set a value to null without specifying the property type.
protected static boolean hasMethod(java.lang.Class cls, java.lang.String name)
           
protected static boolean isReturnClassAcceptable(java.lang.reflect.Method method)
           
protected static java.lang.String modifierName(java.lang.String name, java.lang.Class objClass, java.lang.Class[] clss)
           
protected static java.lang.String propertyName(java.lang.String methodName)
           
static void setProperty(java.lang.Object testObject, java.lang.String propertyName, java.lang.Object value)
          Sets the specified property to the supplied value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected static com.rational.test.ft.util.FtDebug debug

MAX_NUM_ARRAY_PROP

protected static final int MAX_NUM_ARRAY_PROP
See Also:
Constant Field Values
Constructor Detail

JavaBeanProperties

public JavaBeanProperties()
Method Detail

isReturnClassAcceptable

protected static boolean isReturnClassAcceptable(java.lang.reflect.Method method)

getMethod

protected static java.lang.reflect.Method getMethod(java.lang.Class cls,                                                     java.lang.String name)

getArrayMethod

protected static java.lang.reflect.Method getArrayMethod(java.lang.Class cls,                                                          java.lang.String name)

getNonArrayMethod

protected static java.lang.reflect.Method getNonArrayMethod(java.lang.Class cls,                                                             java.lang.String name)

accessorMethod

protected static java.lang.reflect.Method accessorMethod(java.lang.String propertyName,                                                          java.lang.Class cls)

getNonValueProperties

public static void getNonValueProperties(java.lang.Class cls,                                          com.rational.test.ft.sys.HashtableEx properties,                                          IPropertyFilter filter)

getAllProperties

public static void getAllProperties(java.lang.Object testObject,                                     com.rational.test.ft.sys.HashtableEx properties,                                     IPropertyFilter filter)
Iterates across all the methods and validates that the method is public not-static. It also must begin with get, is, or has, and must return a supported type. (isX and hasX must return boolean to be supported.) The method must take no parameters or be of the form getX and take a single integer parameter. If it meets all these requirements, the method is added to a hashtable. If there are get duplicate supported methods (getX, isX, hasX), this order is preferred. (getX is best.) Only one X method can be added to the hashtable. After the hashtable is complete, the methods in it are looped over and called. For each value returned, the return value is checked to see whether it is of a supported type. If it is not, and a property converter from the declared return value of the method exists, that property converter is used. If it is not supported, and no property converter exists, the property is skipped.


getProperty

public static java.lang.Object getProperty(java.lang.Object testObject,                                            java.lang.String property)
Fetches the specified property associated with the control being evaluated; registers it with the supplied object. If the property cannot be found, a PropertyNotFoundException is thrown. Note that if a property exists for which there are no access rights to the method, it is not seen, and a PropertyNotFoundException is thrown.


getSetMethodForNullProperty

public static java.lang.reflect.Method getSetMethodForNullProperty(java.lang.Class testObjectClass,                                                                    java.lang.String propertyName)
get the set method that can be used to set a value to null without specifying the property type. If there are multiple set methods for the property, such that this is ambiguous, null is returned.


setProperty

public static void setProperty(java.lang.Object testObject,                                java.lang.String propertyName,                                java.lang.Object value)
Sets the specified property to the supplied value. The value is normally of the correct type. However, there are instances in which an incorrect type may be specified. For instance, an Integer is commonly passed for Short type objects. Therefore, the type should be checked and necessary conversions performed.

Throws:
RbtInvalidPropertyType - If the specified property cannot be located or set, this exception should be thrown.
Parameters:
property - The name of the property that should be located and set.
value - The value to set the property value to.

hasMethod

protected static boolean hasMethod(java.lang.Class cls,                                    java.lang.String name)

modifierName

protected static java.lang.String modifierName(java.lang.String name,                                                java.lang.Class objClass,                                                java.lang.Class[] clss)

getObjectType

protected static java.lang.Class getObjectType(java.lang.Object value)

propertyName

protected static java.lang.String propertyName(java.lang.String methodName)