IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.util
Class BeanUtil

java.lang.Object
  extended by com.ibm.btt.util.BeanUtil

public class BeanUtil
extends java.lang.Object

Bean utility class


Constructor Summary
BeanUtil()
           
 
Method Summary
static java.lang.String computeGetMethodName(java.lang.String attributeName)
          Compute get method name by attribute name
static java.lang.String computeSetMethodName(java.lang.String attributeName)
          Compute set method name by attribute name
static java.lang.Object getAttribute(java.lang.Object target, java.lang.String attrName)
          Get attribute from target bean by attribute name
static java.lang.Class getAttributeType(java.lang.Object target, java.lang.String attrName)
          Get target bean attribute type by attribute name
static java.lang.reflect.Method getSetMethod(java.lang.Object target, java.lang.String attrName, java.lang.Class paramType)
          Get set method from target bean by attribute name and parameter type
static java.lang.Object newInstance(java.lang.String klassName)
          New bean instance by bean class name
static void setAttribute(java.lang.Object target, java.lang.String attrName, java.util.Date value)
          Set target bean attribute value for date type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, double value)
          Set target bean attribute value for double type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, java.lang.Double value)
          Set target bean attribute value for Double type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, float value)
          Set target bean attribute value for float type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, java.lang.Float value)
          Set target bean attribute value for Float type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, int value)
          Set target bean attribute value for int type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, java.lang.Integer value)
          Set target bean attribute value for Integer type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, long value)
          Set target bean attribute value for long type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, java.lang.Long value)
          Set target bean attribute value for Long type by attribute name
static void setAttribute(java.lang.Object bean, java.lang.String dataName, java.lang.Object value)
          Set target bean attribute value for Object type by attribute name
static void setAttribute(java.lang.Object target, java.lang.String attrName, java.lang.String value)
          Set attribute with value for target bean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtil

public BeanUtil()
Method Detail

newInstance

public static java.lang.Object newInstance(java.lang.String klassName)
                                    throws java.lang.ClassNotFoundException
New bean instance by bean class name

Parameters:
klassName - bean class name
Returns:
bean instance
Throws:
java.lang.ClassNotFoundException

setAttribute

public static void setAttribute(java.lang.Object target,
                                java.lang.String attrName,
                                java.lang.String value)
                         throws AttributeNotFoundException
Set attribute with value for target bean

Parameters:
target - bean
attrName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

getSetMethod

public static java.lang.reflect.Method getSetMethod(java.lang.Object target,
                                                    java.lang.String attrName,
                                                    java.lang.Class paramType)
                                             throws java.lang.NoSuchMethodException
Get set method from target bean by attribute name and parameter type

Parameters:
target - target bean
attrName - attribute name
paramType - parameter type
Returns:
Set method
Throws:
java.lang.NoSuchMethodException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                int value)
                         throws AttributeNotFoundException
Set target bean attribute value for int type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object target,
                                java.lang.String attrName,
                                java.util.Date value)
                         throws AttributeNotFoundException
Set target bean attribute value for date type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                java.lang.Integer value)
                         throws AttributeNotFoundException
Set target bean attribute value for Integer type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

computeGetMethodName

public static java.lang.String computeGetMethodName(java.lang.String attributeName)
Compute get method name by attribute name

Parameters:
attributeName - attribute name
Returns:
get method name

computeSetMethodName

public static java.lang.String computeSetMethodName(java.lang.String attributeName)
Compute set method name by attribute name

Parameters:
attributeName - attribute name
Returns:
set method name

getAttributeType

public static java.lang.Class getAttributeType(java.lang.Object target,
                                               java.lang.String attrName)
                                        throws AttributeNotFoundException
Get target bean attribute type by attribute name

Parameters:
target - target bean
attrName - attribute name
Returns:
attribute class type
Throws:
AttributeNotFoundException

getAttribute

public static java.lang.Object getAttribute(java.lang.Object target,
                                            java.lang.String attrName)
                                     throws AttributeNotFoundException
Get attribute from target bean by attribute name

Parameters:
target - target java bean
attrName - attribute name
Returns:
attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                float value)
                         throws AttributeNotFoundException
Set target bean attribute value for float type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                java.lang.Float value)
                         throws AttributeNotFoundException
Set target bean attribute value for Float type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                double value)
                         throws AttributeNotFoundException
Set target bean attribute value for double type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                java.lang.Double value)
                         throws AttributeNotFoundException
Set target bean attribute value for Double type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                long value)
                         throws AttributeNotFoundException
Set target bean attribute value for long type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                java.lang.Long value)
                         throws AttributeNotFoundException
Set target bean attribute value for Long type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

setAttribute

public static void setAttribute(java.lang.Object bean,
                                java.lang.String dataName,
                                java.lang.Object value)
                         throws AttributeNotFoundException
Set target bean attribute value for Object type by attribute name

Parameters:
bean - target bean
dataName - attribute name
value - attribute value
Throws:
AttributeNotFoundException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2010