Class BeanUtils

java.lang.Object
org.apache.commons.beanutils.BeanUtils
Direct Known Subclasses:
LocaleBeanUtils

public class BeanUtils extends Object

Utility methods for populating JavaBeans properties via reflection.

The implementations are provided by BeanUtilsBean. These static utility methods use the default instance. More sophisticated behaviour can be provided by using a BeanUtilsBean instance.

Version:
$Id$
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static int
    Deprecated.
    BeanUtils now uses commons-logging for all log messages.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    Clone a bean based on the available property getters and setters, even if the bean class itself does not implement Cloneable.
    static void
    Copy property values from the origin bean to the destination bean for all cases where the property names are the same.
    static void
    copyProperty(Object bean, String name, Object value)
    Copy the specified property value to the specified destination bean, performing any type conversion that is required.
    static <K, V> Map<K,V>
    Create a cache.
    static Map<String,String>
    Return the entire set of properties for which the specified bean provides a read method.
    static String[]
    Return the value of the specified array property of the specified bean, as a String array.
    static boolean
    getCacheFast(Map<?,?> map)
    Return whether a Map is fast
    static int
    Deprecated.
    BeanUtils now uses commons-logging for all log messages.
    static String
    Return the value of the specified indexed property of the specified bean, as a String.
    static String
    getIndexedProperty(Object bean, String name, int index)
    Return the value of the specified indexed property of the specified bean, as a String.
    static String
    Return the value of the specified indexed property of the specified bean, as a String.
    static String
    Return the value of the specified mapped property of the specified bean, as a String.
    static String
    Return the value of the (possibly nested) property of the specified name, for the specified bean, as a String.
    static String
    getProperty(Object bean, String name)
    Return the value of the specified property of the specified bean, no matter which property reference format is used, as a String.
    static String
    Return the value of the specified simple property of the specified bean, converted to a String.
    static boolean
    initCause(Throwable throwable, Throwable cause)
    If we're running on JDK 1.4 or later, initialize the cause for the given throwable.
    static void
    populate(Object bean, Map<String,? extends Object> properties)
    Populate the JavaBeans properties of the specified bean, based on the specified name/value pairs.
    static void
    setCacheFast(Map<?,?> map, boolean fast)
    Set whether fast on a Map
    static void
    setDebug(int newDebug)
    Deprecated.
    BeanUtils now uses commons-logging for all log messages.
    static void
    setProperty(Object bean, String name, Object value)
    Set the specified property value, performing type conversions as required to conform to the type of the destination property.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait