elge.engine
Class BeanUtils

java.lang.Object
  |
  +--elge.engine.BeanUtils

public class BeanUtils
extends Object

Bunch of methods that was needed and that work with stuff around bean like objects.

Author:
Pavol Žibrita

Constructor Summary
BeanUtils()
           
 
Method Summary
static Object duplicateBean(Object template)
          Duplicates beans.
static PropertyDescriptor findDescriptor(Class cls, String propName)
          Searches the bean for a property and returns descriptor for it if found.
static PropertyEditor findPropertyEditor(PropertyDescriptor pd)
          Searches for the editor for the PropertyDescriptor.
static Object getPropertyValue(PropertyDescriptor pd, Object bean)
          gets a value from bean like object with a method that is described in the PropertyDescriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtils

public BeanUtils()
Method Detail

getPropertyValue

public static Object getPropertyValue(PropertyDescriptor pd,
                                      Object bean)
gets a value from bean like object with a method that is described in the PropertyDescriptor.

Parameters:
pd - the object's propertydescriptor
bean - the bean like object
Returns:
returns value of the property or null.

findDescriptor

public static PropertyDescriptor findDescriptor(Class cls,
                                                String propName)
Searches the bean for a property and returns descriptor for it if found.

Parameters:
cls - the bean like object class
propName - property name
Returns:
the PropertyDescriptor for the propName or null if not found

findPropertyEditor

public static PropertyEditor findPropertyEditor(PropertyDescriptor pd)
Searches for the editor for the PropertyDescriptor.

Parameters:
pd - Propertydesriptor to search the editor for.
Returns:
the editor or null if not found

duplicateBean

public static Object duplicateBean(Object template)
Duplicates beans. It clones it and returns a freshly created new isntance with all fields equals that are bean introspector viewable.

Parameters:
template - bean like object to clone
Returns:
returns the cloned object or null if something wrong with cloning.