T - is the annotated classpublic class RawMapper<T> extends SimpleMapper<T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
RawMapper.FromJSON<T>
Mapping from JSON to object.
|
static interface |
RawMapper.ToJSON<T>
Mapping from object to JSON.
|
type| Constructor and Description |
|---|
RawMapper(Class<T> type,
RawMapper.ToJSON<T> toJSON,
RawMapper.FromJSON<T> fromJSON)
Create a new mapper for a @JSONRaw annotated class.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
createJSON(T obj)
Convert object to JSON.
|
T |
createObject(Object json)
Create object from JSON representation.
|
static <T> RawMapper.FromJSON<T> |
fromJSONAnnotated(Class<T> clazz,
Method method)
Create mapping from JSON to object from a @FromJSON annotated method.
|
static <T> RawMapper.FromJSON<T> |
fromJSONConstructor(Class<T> clazz,
Constructor<T> constructor)
Create mapping from JSON to object by a constructor.
|
static <T> boolean |
isJSONConstructor(Constructor<T> constructor)
Check if constructor may be used to convert from JSON to object.
|
static <T> RawMapper.ToJSON<T> |
toJSONAnnotated(Class<T> clazz,
Method method)
Create mapping from object to JSON from a @ToJSON annotated method.
|
static <T> RawMapper.ToJSON<T> |
toJSONDefault(Class<T> clazz)
Create default mapping from object to JSON.
|
asArray, componentFromJSON, componentToJSON, fieldFromJSON, fieldToJSON, getFromJSON, setToJSONpublic RawMapper(Class<T> type, RawMapper.ToJSON<T> toJSON, RawMapper.FromJSON<T> fromJSON)
type - the annotated classtoJSON - converts object to JSON; mostly created by fromJSONAnnotated or fromJSONConstructedfromJSON - converts JSON to object; mostly created by toJSONAnnotated or toJSONDefaultpublic 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.public static <T> RawMapper.FromJSON<T> fromJSONAnnotated(Class<T> clazz, Method method)
T - the annotateded typeclazz - annotated classmethod - static method in the annotated class to do the mappingpublic static <T> boolean isJSONConstructor(Constructor<T> constructor)
T - the annotateded typeconstructor - the constructorpublic static <T> RawMapper.FromJSON<T> fromJSONConstructor(Class<T> clazz, Constructor<T> constructor)
T - the annotateded typeclazz - annotated classconstructor - constructor in the annotated class to do the mappingpublic static <T> RawMapper.ToJSON<T> toJSONAnnotated(Class<T> clazz, Method method)
T - the annotateded typeclazz - annotated classmethod - method in the annotated class to do the mappingpublic static <T> RawMapper.ToJSON<T> toJSONDefault(Class<T> clazz)
T - the annotateded typeclazz - JSONRaw annotated classCopyright © 2014–2016 Tomas Teubner. All rights reserved.