org.littleshoot.util
Class BeanUtils

java.lang.Object
  extended by org.littleshoot.util.BeanUtils

public final class BeanUtils
extends Object

Java bean utilities class.


Method Summary
static Map<String,String> mapBean(Object bean)
          Creates a Map from all bean data.
static Map<String,String> mapBean(Object bean, Set<String> excludes)
          Creates a Map from all bean data get methods except the ones specified to exclude.
static Map<String,String> mapBean(Object bean, String exclude)
          Creates a Map from all bean data get methods except the one specified to exclude.
static void populateBean(Object bean, Map<String,String> params)
          Populates the specified bean with data from the specified map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

mapBean

public static Map<String,String> mapBean(Object bean)
Creates a Map from all bean data.

Parameters:
bean - The bean with data to extract.
Returns:
The map of bean data.

mapBean

public static Map<String,String> mapBean(Object bean,
                                         String exclude)
Creates a Map from all bean data get methods except the one specified to exclude. Note that "getClass" is always excluded.

Parameters:
bean - The bean with data to extract.
exclude - A method name to exclude.
Returns:
The map of bean data.

mapBean

public static Map<String,String> mapBean(Object bean,
                                         Set<String> excludes)
Creates a Map from all bean data get methods except the ones specified to exclude. Note that "getClass" is always excluded.

Parameters:
bean - The bean with data to extract.
excludes - The method names to exclude.
Returns:
The map of bean data.

populateBean

public static void populateBean(Object bean,
                                Map<String,String> params)
Populates the specified bean with data from the specified map.

Parameters:
bean - The object to populate.
params - The map to populate the bean with.


Copyright © 2011-2013 LittleShoot. All Rights Reserved.