public class BeanHelper extends Object
Modifier and Type | Class and Description |
---|---|
class |
BeanHelper.Bean1 |
class |
BeanHelper.Bean2 |
Constructor and Description |
---|
BeanHelper() |
Modifier and Type | Method and Description |
---|---|
static Map |
bean2Map(Object bean) |
static List<String> |
beanSetList(Object bean) |
static String |
beanToString(Object bean) |
static int |
copy(Map map,
Object bean)
copy map in bean, call set[key] ( value ).
|
static void |
copy(Object bean1,
Object bean2)
copy bean1 in bean2, if method set exist in bean2.
|
static void |
extractPropertiesAsString(Map<String,Object> out,
Object bean,
String... propertyNames) |
static String[] |
getAllLabels(Object bean) |
static String[] |
getAllLabelsSorted(Object bean)
sort label by buisness importance, start with, login, email, firstName,
lastName
|
static Object[] |
getAllValues(Object bean) |
static Object |
getProperty(Object bean,
String property) |
static void |
main(String[] args) |
static Object |
setProperty(Object bean,
String property,
Object value) |
static void |
storeBeanToCSV(File file,
Collection<Object> beans) |
void |
test() |
public static Map bean2Map(Object bean) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
public static List<String> beanSetList(Object bean) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
public static int copy(Map map, Object bean) throws SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
a
- generic mapbean
- a class with set and get method.SecurityException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
public static void extractPropertiesAsString(Map<String,Object> out, Object bean, String... propertyNames)
public static void copy(Object bean1, Object bean2) throws SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
bean1
- a class with set and get method.bean2
- a class with set and get method.SecurityException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
public static String[] getAllLabelsSorted(Object bean)
bean
- public static void storeBeanToCSV(File file, Collection<Object> beans) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, IOException
public static void main(String[] args)
public void test() throws SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
Copyright © 2012-2018. All Rights Reserved.