public class ReflectiveMapper<T> extends SimpleMapper<T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
ReflectiveMapper.AttributeMapper |
| Modifier and Type | Field and Description |
|---|---|
protected ReflectiveMapper.AttributeMapper[] |
attributeMappers |
protected Constructor<T> |
constructor |
protected ReflectiveMapper<? super T> |
parentMapper |
type| Constructor and Description |
|---|
ReflectiveMapper(Class<T> type,
Constructor<T> constructor,
ReflectiveMapper<? super T> parentMapper,
ReflectiveMapper.AttributeMapper[] attributeMappers) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
copyFromJSON(T obj,
org.json.JSONObject json) |
protected void |
copyToJSON(org.json.JSONObject json,
T obj) |
static ReflectiveMapper.AttributeMapper |
createBeanAttributeMapper(String name,
Method getter,
Method setter,
JSONMapper<?> mapper) |
static ReflectiveMapper.AttributeMapper |
createFieldMapper(Field field,
JSONMapper<?> mapper) |
Object |
createJSON(T obj)
Convert object to JSON.
|
T |
createObject(Object json)
Create object from JSON representation.
|
asArray, componentFromJSON, componentToJSON, fieldFromJSON, fieldToJSON, getFromJSON, setToJSONprotected final Constructor<T> constructor
protected final ReflectiveMapper<? super T> parentMapper
protected final ReflectiveMapper.AttributeMapper[] attributeMappers
public ReflectiveMapper(Class<T> type, Constructor<T> constructor, ReflectiveMapper<? super T> parentMapper, ReflectiveMapper.AttributeMapper[] attributeMappers)
public static ReflectiveMapper.AttributeMapper createFieldMapper(Field field, JSONMapper<?> mapper)
public static ReflectiveMapper.AttributeMapper createBeanAttributeMapper(String name, Method getter, Method setter, JSONMapper<?> mapper)
public Object createJSON(T obj)
JSONMappercreateJSON in interface JSONMapper<T>createJSON in class SimpleMapper<T>obj - object to be convertedpublic T createObject(Object json)
JSONMappercreateObject in interface JSONMapper<T>createObject in class SimpleMapper<T>json - JSON representation.protected void copyToJSON(org.json.JSONObject json,
T obj)
protected void copyFromJSON(T obj, org.json.JSONObject json)
Copyright © 2014–2015 Tomas Teubner. All rights reserved.