|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Objectcom.seeyon.ctp.util.json.mapper.JSONMapper
public class JSONMapper
The mapper class is able to convert a JSON representation to/from a Java representation. The mapper's goal is to produce a nice and clean JSON output which can easily be used in e.g. Javascript context. As a consequence, not all Java constructs are preserved during the conversion to/from JSON. The mapper is the best choice in an application where the clean JSON format is central. If the emphasis is on exact Java serialization where types are preserved, take a look at the Serializer tool. The main difference between the serializer and the mapper is that the serializer keeps as much type information and structure information in the JSON data where the mapper uses the type information in the provided Java classes to interprete the JSON data.
构造方法摘要 | |
---|---|
JSONMapper()
|
方法摘要 | |
---|---|
static java.lang.Class<?> |
getParameterizedTypeLocal()
|
static void |
setParameterizedTypeLocal(java.lang.Class<?> clz)
|
static java.lang.Object |
toJava(com.seeyon.ctp.util.json.model.JSONValue aValue)
Map a JSON representation to a Java object. |
static java.lang.Object |
toJava(com.seeyon.ctp.util.json.model.JSONValue aValue,
java.lang.Class aPojoClass)
Map a JSON representation to a Java object. |
static com.seeyon.ctp.util.json.model.JSONValue |
toJSON(java.lang.Object aPojo)
Map a POJO to the JSON representation. |
static com.seeyon.ctp.util.json.model.JSONValue |
toJSONNOExtraAttr(java.lang.Object aPojo)
返回不含额外属性(extraAttr)的PO的JSON |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造方法详细信息 |
---|
public JSONMapper()
方法详细信息 |
---|
public static void setParameterizedTypeLocal(java.lang.Class<?> clz)
public static java.lang.Class<?> getParameterizedTypeLocal()
public static java.lang.Object toJava(com.seeyon.ctp.util.json.model.JSONValue aValue, java.lang.Class aPojoClass) throws MapperException
aValue
- The JSON value that has to be mapped.aPojoClass
- The class to which the JSON object should be mapped.
MapperException
- when an error occurs during mapping.public static java.lang.Object toJava(com.seeyon.ctp.util.json.model.JSONValue aValue) throws MapperException
aValue
- The JSON value that has to be mapped.
MapperException
- When the JSON text cannot be mapped to POJO.public static com.seeyon.ctp.util.json.model.JSONValue toJSON(java.lang.Object aPojo) throws MapperException
aPojo
- to be mapped to JSON.
MapperException
- If something goes wrong during mapping.public static com.seeyon.ctp.util.json.model.JSONValue toJSONNOExtraAttr(java.lang.Object aPojo) throws MapperException
aPojo
-
MapperException
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |