com.interface21.beans
Class BeanUtils

java.lang.Object
  |
  +--com.interface21.beans.BeanUtils

public abstract class BeanUtils
extends java.lang.Object

Static convenience methods for JavaBeans. Provides e.g. methods for sorting lists of beans by any property.

Author:
Rod Johnson, Juergen Hoeller

Constructor Summary
BeanUtils()
           
 
Method Summary
static void copyProperties(java.lang.Object source, java.lang.Object target)
          Copy the property values of the given source bean into the target bean.
static void copyProperties(java.lang.Object source, java.lang.Object target, java.lang.String[] ignoreProperties)
          Copy the property values of the given source bean into the given target bean, ignoring the given ignoreProperties.
static java.lang.Object instantiateClass(java.lang.Class clazz)
          Convenience method to instantiate a class using its no arg constructor.
 
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

instantiateClass

public static java.lang.Object instantiateClass(java.lang.Class clazz)
                                         throws BeansException
Convenience method to instantiate a class using its no arg constructor. As this method doesn't try to load classes by name, it should avoid class-loading issues.
Parameters:
clazz - class to instantiate.

copyProperties

public static void copyProperties(java.lang.Object source,
                                  java.lang.Object target)
                           throws java.lang.IllegalArgumentException,
                                  BeansException
Copy the property values of the given source bean into the target bean.
Parameters:
source - source bean
target - target bean
Throws:
java.lang.IllegalArgumentException - if the classes of source and target do not match

copyProperties

public static void copyProperties(java.lang.Object source,
                                  java.lang.Object target,
                                  java.lang.String[] ignoreProperties)
                           throws java.lang.IllegalArgumentException,
                                  BeansException
Copy the property values of the given source bean into the given target bean, ignoring the given ignoreProperties.
Parameters:
source - source bean
target - target bean
ignoreProperties - array of property names to ignore
Throws:
java.lang.IllegalArgumentException - if the classes of source and target do not match


Rod Johnson and Spring contributors 2001-2003.