public class JSONPojoConvertor extends Object implements JSON.Convertor
Modifier and Type | Class and Description |
---|---|
static interface |
JSONPojoConvertor.NumberType |
static class |
JSONPojoConvertor.Setter |
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
_excluded |
protected boolean |
_fromJSON |
protected Map<String,Method> |
_getters |
protected Class<?> |
_pojoClass |
protected Map<String,JSONPojoConvertor.Setter> |
_setters |
static JSONPojoConvertor.NumberType |
DOUBLE |
static JSONPojoConvertor.NumberType |
FLOAT |
static Object[] |
GETTER_ARG |
static JSONPojoConvertor.NumberType |
INTEGER |
static JSONPojoConvertor.NumberType |
LONG |
static Object[] |
NULL_ARG |
static JSONPojoConvertor.NumberType |
SHORT |
Constructor and Description |
---|
JSONPojoConvertor(Class<?> pojoClass) |
JSONPojoConvertor(Class<?> pojoClass,
boolean fromJSON) |
JSONPojoConvertor(Class<?> pojoClass,
Set<String> excluded) |
JSONPojoConvertor(Class<?> pojoClass,
Set<String> excluded,
boolean fromJSON) |
JSONPojoConvertor(Class<?> pojoClass,
String[] excluded) |
Modifier and Type | Method and Description |
---|---|
protected void |
addGetter(String name,
Method method) |
protected void |
addSetter(String name,
Method method) |
Object |
fromJSON(Map object) |
protected int |
getExcludedCount() |
static JSONPojoConvertor.NumberType |
getNumberType(Class<?> clazz) |
protected JSONPojoConvertor.Setter |
getSetter(String name) |
protected boolean |
includeField(String name,
Method m) |
protected void |
init() |
protected void |
log(Throwable t) |
int |
setProps(Object obj,
Map<?,?> props) |
void |
toJSON(Object obj,
JSON.Output out) |
public static final Object[] GETTER_ARG
public static final Object[] NULL_ARG
protected boolean _fromJSON
protected Class<?> _pojoClass
protected Map<String,JSONPojoConvertor.Setter> _setters
public static final JSONPojoConvertor.NumberType SHORT
public static final JSONPojoConvertor.NumberType INTEGER
public static final JSONPojoConvertor.NumberType FLOAT
public static final JSONPojoConvertor.NumberType LONG
public static final JSONPojoConvertor.NumberType DOUBLE
public JSONPojoConvertor(Class<?> pojoClass)
pojoClass
- The class to convertpublic JSONPojoConvertor(Class<?> pojoClass, String[] excluded)
pojoClass
- The class to convertexcluded
- The fields to excludepublic JSONPojoConvertor(Class<?> pojoClass, Set<String> excluded)
pojoClass
- The class to convertexcluded
- The fields to excludepublic JSONPojoConvertor(Class<?> pojoClass, Set<String> excluded, boolean fromJSON)
pojoClass
- The class to convertexcluded
- The fields to excludefromJSON
- If true, add a class field to the JSONpublic JSONPojoConvertor(Class<?> pojoClass, boolean fromJSON)
pojoClass
- The class to convertfromJSON
- If true, add a class field to the JSONpublic static JSONPojoConvertor.NumberType getNumberType(Class<?> clazz)
protected void init()
protected JSONPojoConvertor.Setter getSetter(String name)
protected int getExcludedCount()
public Object fromJSON(Map object)
fromJSON
in interface JSON.Convertor
public void toJSON(Object obj, JSON.Output out)
toJSON
in interface JSON.Convertor
protected void log(Throwable t)
Copyright © 1995-2015 Webtide. All Rights Reserved.