org.xins.common
Class BeanUtils

java.lang.Object
  extended byorg.xins.common.BeanUtils

public class BeanUtils
extends Object

This class contains some utility methods that fills an object with values from another object.

Since:
XINS 1.5.0.
Version:
$Revision: 1.12.2.1 $ $Date: 2006/12/22 15:44:53 $
Author:
Anthony Goubard

Constructor Summary
BeanUtils()
           
 
Method Summary
static Object populate(Object source, Object destination)
          Get the values returned by the get methods of the source object and call the set method of the destination object for the same property.
static Object populate(Object source, Object destination, Properties propertiesMapping)
          Get the values returned by the get methods of the source object and call the set method of the destination object for the same property.
static Object xmlToObject(Element element, Object result)
          Fills the result object with of the content of the XML element object.
 
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

populate

public static Object populate(Object source,
                              Object destination)
Get the values returned by the get methods of the source object and call the set method of the destination object for the same property. e.g. String getFirstName() value of the source object will be used to invoke setFirstName(String) of the destination object. If the no matching set method exists or the set method parameter is not the same type as the object returned by the get method, the property is ignored.

Parameters:
source - the source object to get the values from. Cannot be null.
destination - the destination object to put the values in. Cannot be null.
Returns:
the populated object, never null.

populate

public static Object populate(Object source,
                              Object destination,
                              Properties propertiesMapping)
Get the values returned by the get methods of the source object and call the set method of the destination object for the same property. e.g. String getFirstName() value of the source object will be used to invoke setFirstName(String) of the destination object. If the no matching set method exists or the set method parameter is not the same type as the object returned by the get method, the property is ignored.

Parameters:
source - the source object to get the values from. Cannot be null.
destination - the destination object to put the values in. Cannot be null.
propertiesMapping - the mapping between properties which does not have the same name.
Returns:
the populated object, never null.

xmlToObject

public static Object xmlToObject(Element element,
                                 Object result)
Fills the result object with of the content of the XML element object.

Parameters:
element - the XML element object, cannot be null.
result - the object to put the values in, cannot be null.
Returns:
the result object filled with the values of the element object, never null.


See http://www.xins.org/.