public class BeanUtils extends Object
Constructor and Description |
---|
BeanUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
atIndex(Class<T> type,
Object object,
String property) |
static Object |
atIndex(Object object,
String path)
Get property value
|
static Object |
byPath(Object object,
String path) |
static <V> Map<String,V> |
collectionToMap(String propertyKey,
Collection<V> values) |
static <T> T |
copy(T item) |
static void |
copyProperties(Object object,
Map<String,Object> properties) |
static void |
copyProperties(Object src,
Object dest) |
static void |
copyProperties(Object src,
Object dest,
Set<String> ignore) |
static void |
copyProperties(Object src,
Object dest,
String... ignore) |
static <T> T |
createFromSrc(Object src,
Class<T> dest) |
static <T> T |
fieldByFieldCopy(T item) |
static Object |
findProperty(Object context,
String propertyPath) |
static FieldAccess |
getField(Class clazz,
String name) |
static FieldAccess |
getField(Object object,
String name) |
static Map<String,FieldAccess> |
getFieldsFromObject(Class<?> cls) |
static Map<String,FieldAccess> |
getFieldsFromObject(Object object)
Get fields from object or Map.
|
static Object |
getFieldValuesFromCollection(Collection collection,
String key) |
static Object |
getFieldValuesFromCollection(Object object,
String key) |
static Object |
getProp(Object object,
String property)
This is one is forgiving of null paths.
|
static Object |
getPropByPath(Object item,
String... path)
This method handles walking lists of lists.
|
static boolean |
getPropertyBoolean(Object root,
String... properties) |
static byte |
getPropertyByte(Object root,
String... properties) |
static char |
getPropertyChar(Object root,
String... properties) |
static double |
getPropertyDouble(Object root,
String... properties) |
static float |
getPropertyFloat(Object root,
String... properties) |
static int |
getPropertyInt(Object root,
String... properties)
Get an int property.
|
static long |
getPropertyLong(Object root,
String... properties) |
static FieldAccess |
getPropertyPathField(Class root,
String... properties)
Get Property Path Type
|
static FieldAccess |
getPropertyPathField(Object root,
String... properties)
Get Property Path Type
|
static Class<?> |
getPropertyPathType(Object root,
String... properties)
Get Property Path Type
|
static short |
getPropertyShort(Object root,
String... properties) |
static Class<?> |
getPropertyType(Object root,
String property)
Get property value, loads nested properties
|
static Object |
getPropertyValue(Object root,
String... properties)
Get property value, loads nested properties
|
static void |
idx(Class<?> cls,
String path,
Object value)
Set a static value
|
static <T> T |
idx(Class<T> type,
Object object,
String property) |
static Object |
idx(Object object,
int index) |
static void |
idx(Object object,
int index,
Object value) |
static Object |
idx(Object object,
String path)
Get property value
|
static void |
idx(Object object,
String path,
Object value)
Set property value
|
static boolean |
idxBoolean(Object object,
String path) |
static byte |
idxByte(Object object,
String path) |
static char |
idxChar(Object object,
String path) |
static double |
idxDouble(Object object,
String path) |
static FieldAccess |
idxField(Class<?> cls,
String path) |
static FieldAccess |
idxField(Object object,
String path) |
static float |
idxFloat(Object object,
String path) |
static <T> T |
idxGeneric(Class<T> t,
Object object,
String path) |
static int |
idxInt(Object object,
String path)
Get property value
|
static <T> List<T> |
idxList(Class<T> cls,
Object items,
String... path) |
static long |
idxLong(Object object,
String path) |
static short |
idxShort(Object object,
String path) |
static String |
idxStr(Object object,
String path)
Get property value
|
static Class |
idxType(Object object,
String path) |
static Object |
indexOf(Object object,
String path)
Deprecated.
use atIndex or idx.
|
static void |
injectIntoProperty(Object object,
String path,
Object value)
Set property value to simulate dependency injection.
|
static boolean |
isPropPath(String prop)
Is this a property path?
|
static void |
setCollectionProperty(Collection<?> list,
String propertyName,
Object value) |
static void |
setIterableProperty(Iterable<?> list,
String propertyName,
Object value) |
static void |
setPropertyValue(Class<?> root,
Object newValue,
String... properties)
Get property value, loads nested properties
|
static void |
setPropertyValue(Object root,
Object newValue,
String... properties)
Get property value, loads nested properties
|
public static FieldAccess getField(Class clazz, String name)
public static FieldAccess getField(Object object, String name)
public static Map<String,FieldAccess> getFieldsFromObject(Class<?> cls)
public static Map<String,FieldAccess> getFieldsFromObject(Object object)
object
- public static void setPropertyValue(Object root, Object newValue, String... properties)
root
- properties
- public static void setPropertyValue(Class<?> root, Object newValue, String... properties)
root
- properties
- public static Object getPropertyValue(Object root, String... properties)
root
- properties
- public static Class<?> getPropertyType(Object root, String property)
root
- property
- public static Object getPropByPath(Object item, String... path)
item
- path
- public static Object idx(Object object, String path)
object
- path
- in dotted notationpublic static Object indexOf(Object object, String path)
object
- path
- in dotted notationpublic static Object atIndex(Object object, String path)
object
- path
- in dotted notationpublic static void injectIntoProperty(Object object, String path, Object value)
object
- path
- in dotted notationpublic static void idx(Object object, String path, Object value)
object
- path
- in dotted notationpublic static void idx(Class<?> cls, String path, Object value)
cls
- path
- in dotted notationpublic static Object getProp(Object object, String property)
object
- property
- public static int getPropertyInt(Object root, String... properties)
public static int idxInt(Object object, String path)
object
- path
- in dotted notationpublic static String idxStr(Object object, String path)
object
- path
- in dotted notationpublic static byte getPropertyByte(Object root, String... properties)
root
- properties
- public static float getPropertyFloat(Object root, String... properties)
root
- properties
- public static float idxFloat(Object object, String path)
object
- path
- public static short getPropertyShort(Object root, String... properties)
root
- properties
- public static Class<?> getPropertyPathType(Object root, String... properties)
root
- properties
- public static FieldAccess getPropertyPathField(Object root, String... properties)
root
- properties
- public static FieldAccess getPropertyPathField(Class root, String... properties)
root
- properties
- public static short idxShort(Object object, String path)
object
- path
- public static FieldAccess idxField(Object object, String path)
object
- path
- public static FieldAccess idxField(Class<?> cls, String path)
cls
- path
- public static char getPropertyChar(Object root, String... properties)
root
- properties
- public static double getPropertyDouble(Object root, String... properties)
root
- properties
- public static double idxDouble(Object object, String path)
object
- path
- public static long getPropertyLong(Object root, String... properties)
root
- properties
- public static boolean getPropertyBoolean(Object root, String... properties)
root
- properties
- public static <V> Map<String,V> collectionToMap(String propertyKey, Collection<V> values)
public static Object getFieldValuesFromCollection(Collection collection, String key)
public static Object getFieldValuesFromCollection(Object object, String key)
public static <T> T copy(T item)
public static <T> T fieldByFieldCopy(T item)
public static boolean isPropPath(String prop)
prop
- propertypublic static void setCollectionProperty(Collection<?> list, String propertyName, Object value)
Copyright © 2014. All rights reserved.