public class BeanDelegator extends Object
| Modifier and Type | Class and Description |
|---|---|
protected class |
BeanDelegator.DelegateInvocationHandler |
| Modifier and Type | Field and Description |
|---|---|
static String |
NULL
Indicate NULL value for a field (To overcome shortcome of immutable map)
|
static com.google.common.collect.ImmutableSet<Class<?>> |
PRIMITIVE_TYPE_CLASSES
List of Classes that are considered primitives and are not proxied
|
| Constructor and Description |
|---|
BeanDelegator() |
BeanDelegator(Map<Class<?>,Class<?>> delegatedClasses,
Map<Enum<?>,Enum<?>> enumConvertionMap) |
| Modifier and Type | Method and Description |
|---|---|
Enum<?> |
convertEnum(Enum<?> value) |
static Map<Enum<?>,Enum<?>> |
createDefaultEnumMap(Class<? extends Enum<?>> sourceEnum,
Class<? extends Enum<?>> targetEnum)
Utility function to auto generate mapping between two enums that have same values (toString)
All values in the sourceEnum must have values in targetEnum,
otherwise
RuntimeException is thrown |
Object |
createDelegator(Object source)
Create a proxy for the real object.
|
<T> T |
createDelegator(Object source,
Class<T> apiInterface) |
<T> T |
createDelegator(Object source,
Class<T> apiInterface,
Map<String,Object> extraFields) |
static Object |
nullable(Object o)
Gate a value to use NULL constant instead of null pointer
|
void |
validate()
Validate all proxied classes to see that all required functions are implemented.
|
void |
validate(Class<?> dataClass,
Class<?> interfaceClass) |
public static final String NULL
public static final com.google.common.collect.ImmutableSet<Class<?>> PRIMITIVE_TYPE_CLASSES
public static Object nullable(Object o)
public Object createDelegator(Object source)
source - item to proxypublic <T> T createDelegator(Object source, Class<T> apiInterface, Map<String,Object> extraFields)
public void validate()
throws SecurityException,
NoSuchMethodException,
NoSuchFieldException
public void validate(Class<?> dataClass, Class<?> interfaceClass) throws SecurityException, NoSuchMethodException, NoSuchFieldException
public static Map<Enum<?>,Enum<?>> createDefaultEnumMap(Class<? extends Enum<?>> sourceEnum, Class<? extends Enum<?>> targetEnum)
RuntimeException is thrownCopyright © 2007-2012. All Rights Reserved.