jodd.bean
Class BeanTool

java.lang.Object
  extended by jodd.bean.BeanTool

public class BeanTool
extends Object

Various utilities that are applied on whole bean(s).


Constructor Summary
BeanTool()
           
 
Method Summary
static void apply(Object source, Object destination)
          Applies only public properties.
static void apply(Object source, Object destination, boolean suppressSecurity)
          Same as copy(Object, Object, boolean), except null values are not copied.
static void copy(Object source, Object destination)
          Copies only public properties.
static void copy(Object source, Object destination, boolean suppressSecurity)
          Copies properties of one bean to another.
static void load(Object bean, Object source)
          Populates bean from given object by using a loader for given objects type.
static void load(Object bean, Object source, Class type)
           
static String[] resolveProperties(Object bean, boolean suppressSecurity)
          Returns an array of bean properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanTool

public BeanTool()
Method Detail

copy

public static void copy(Object source,
                        Object destination,
                        boolean suppressSecurity)
Copies properties of one bean to another. Iterates all getXXX() methods, reads values and populates destination bean through setXXX(). No exception is thrown on error.

Parameters:
source - source bean, one to read properties from
destination - destination bean, to write properties to
suppressSecurity - true to suppress security

apply

public static void apply(Object source,
                         Object destination,
                         boolean suppressSecurity)
Same as copy(Object, Object, boolean), except null values are not copied. Useful when destination object needs to be only partially updated.


copy

public static void copy(Object source,
                        Object destination)
Copies only public properties.

See Also:
copy(Object, Object, boolean)

apply

public static void apply(Object source,
                         Object destination)
Applies only public properties.

See Also:
apply(Object, Object, boolean)

resolveProperties

public static String[] resolveProperties(Object bean,
                                         boolean suppressSecurity)
Returns an array of bean properties. If bean is a map, all its keys will be returned.


load

public static void load(Object bean,
                        Object source)
Populates bean from given object by using a loader for given objects type.


load

public static void load(Object bean,
                        Object source,
                        Class type)