org.wdssii.core
Class PropertyGetterSetter

java.lang.Object
  extended by org.wdssii.core.PropertyGetterSetter

public class PropertyGetterSetter
extends Object

A generic property setter that uses a Properties file to set properties on an object. Built on top of java.beans

Author:
lakshman

Field Summary
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
PropertyGetterSetter()
           
 
Method Summary
static Properties getProperties(Object object)
          Invoke all getter methods on object
static void setProperties(Object object, Properties props)
          Invoke any setter method on object if the corresponding property is found in props.
static boolean setProperty(Object object, Method setter, String name, String value)
          Invoke setter on object with the provided value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
Constructor Detail

PropertyGetterSetter

public PropertyGetterSetter()
Method Detail

setProperties

public static void setProperties(Object object,
                                 Properties props)
Invoke any setter method on object if the corresponding property is found in props. If any properties are not set, explanation of why is sent to the debug log.

Parameters:
object - whose setter methods should be invoked
props - contains name=value pairs with the corresponding properties

getProperties

public static Properties getProperties(Object object)
Invoke all getter methods on object

Parameters:
object - whose getter methods should be invoked
Returns:
properties object that contains name=value pairs with the corresponding properties

setProperty

public static boolean setProperty(Object object,
                                  Method setter,
                                  String name,
                                  String value)
Invoke setter on object with the provided value.

Parameters:
object -
setter -
name - name of property (used only for logging)
value - value to call setter method with
Returns:
whether the setter method succeeded. On failure, see debug log.