@Component public class JsonHandler extends Object
| Constructor and Description |
|---|
JsonHandler() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
convertValue(Object object,
Class<T> clazz) |
<T> T |
readValue(String json,
Class<T> clazz)
Creates a object from a json String.
|
<T> T |
readValue(String json,
org.codehaus.jackson.type.TypeReference<T> typeReference)
Creates a object from a json String.
|
void |
setIndentMapper(org.codehaus.jackson.map.ObjectMapper indentMapper) |
void |
setMapper(org.codehaus.jackson.map.ObjectMapper mapper) |
String |
writeValueAsString(Object obj)
Converts a object into a String containing the json representation of this
object.
|
String |
writeValueAsString(Object obj,
boolean indent)
Converts a object into a String containing the json representation of this
object.
|
public void setMapper(org.codehaus.jackson.map.ObjectMapper mapper)
public void setIndentMapper(org.codehaus.jackson.map.ObjectMapper indentMapper)
public String writeValueAsString(Object obj)
obj - the object to serialize into jsonpublic String writeValueAsString(Object obj, boolean indent)
obj - the object to serialize into jsonindent - if false writes json on one linepublic <T> T readValue(String json, org.codehaus.jackson.type.TypeReference<T> typeReference)
T - type of the object to createjson - String with the jsontypeReference - TypeReference instance of the desired result type
TypeReferencepublic <T> T readValue(String json, Class<T> clazz)
T - type of the object to createjson - String with the jsonclazz - Class of object to createCopyright © 2010-2012. All Rights Reserved.