public class PropertyAccessorHelper extends Object
| Constructor and Description |
|---|
PropertyAccessorHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
fromDate(Class<?> targetClass,
Class<?> sourceClass,
Object o) |
static Object |
fromSourceToTargetClass(Class<?> targetClass,
Class<?> sourceClass,
Object o) |
static byte[] |
get(Object from,
Field field)
Gets field value as byte-array.
|
static byte[] |
getBytes(Object o) |
static Collection |
getCollectionInstance(Field collectionField) |
static Field[] |
getDeclaredFields(Field relationalField)
Gets the declared fields.
|
static Class<?> |
getGenericClass(Field collectionField)
Retrieves Generic class from a collection field that has only one
argument.
|
static List<Class<?>> |
getGenericClasses(Field collectionField)
Retrieves Generic class from a collection field that has only one
argument.
|
static Object |
getId(Object entity,
EntityMetadata metadata)
Get identifier of an entity object by invoking getXXX() method.
|
static Object |
getObject(Class<?> clazz) |
static Object |
getObject(Class clazz,
byte[] b) |
static Object |
getObject(Object from,
Field field)
Gets object from field.
|
static Object |
getObject(Object obj,
String fieldName)
Gets the embedded object.
|
static Object |
getObjectCopy(Object from,
Field field)
Retutrns copy of object
|
static String |
getString(Object o) |
static String |
getString(Object from,
Field field)
Gets the string.
|
private static Class<?> |
getTypedClass(Type type)
Gets the typed class.
|
static boolean |
isCollection(Class<?> clazz)
Checks if is collection.
|
static void |
set(Object target,
Field field,
byte[] bytes)
Sets a byte-array onto a field.
|
static void |
set(Object target,
Field field,
Object value)
Sets an object onto a field.
|
static void |
set(Object target,
Field field,
String fieldVal)
Sets a byte-array onto a field.
|
static void |
setId(Object entity,
EntityMetadata metadata,
byte[] rowKey)
Sets Primary Key (Row key) into entity field that was annotated with @Id.
|
static void |
setId(Object entity,
EntityMetadata metadata,
Object rowKey)
Sets Primary Key (Row key) into entity field that was annotated with @Id.
|
static byte[] |
toBytes(Object o,
Class c) |
static byte[] |
toBytes(Object o,
Field f) |
private static Class<?> |
toClass(Type o)
Borrowed from java.lang.class
|
public static void set(Object target, Field field, byte[] bytes)
target - the targetfield - the fieldbytes - the bytesPropertyAccessException - the property access exceptionpublic static void set(Object target, Field field, String fieldVal)
target - the targetfield - the fieldfieldVal - the field valuePropertyAccessException - the property access exceptionpublic static void set(Object target, Field field, Object value)
target - the targetfield - the fieldvalue - the valuePropertyAccessException - the property access exceptionpublic static Object getObject(Object from, Field field)
from - the fromfield - the fieldPropertyAccessException - the property access exceptionpublic static Object getObjectCopy(Object from, Field field)
from - field - public static String getString(Object from, Field field)
from - the fromfield - the fieldPropertyAccessException - the property access exceptionpublic static byte[] get(Object from, Field field)
from - the fromfield - the fieldPropertyAccessException - the property access exceptionpublic static Object getId(Object entity, EntityMetadata metadata)
entity - the entitymetadata - the metadataPropertyAccessException - the property access exceptionpublic static void setId(Object entity, EntityMetadata metadata, Object rowKey)
entity - the entitymetadata - the metadatarowKey - the row keyPropertyAccessException - the property access exceptionpublic static void setId(Object entity, EntityMetadata metadata, byte[] rowKey)
entity - the entitymetadata - the metadatarowKey - the row keyPropertyAccessException - the property access exceptionpublic static final Object getObject(Object obj, String fieldName)
obj - the objfieldName - the field namePropertyAccessException - the property access exceptionpublic static Class<?> getGenericClass(Field collectionField)
collectionField - the collection fieldpublic static List<Class<?>> getGenericClasses(Field collectionField)
collectionField - the collection fieldpublic static Field[] getDeclaredFields(Field relationalField)
relationalField - the relational fieldpublic static final boolean isCollection(Class<?> clazz)
clazz - the clazzpublic static Object fromSourceToTargetClass(Class<?> targetClass, Class<?> sourceClass, Object o)
public static byte[] getBytes(Object o)
public static final Collection getCollectionInstance(Field collectionField)
private static Class<?> toClass(Type o)
o - Copyright © 2015. All Rights Reserved.