@Component
public class JsonHandler
extends java.lang.Object
| Constructor and Description |
|---|
JsonHandler() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
convertValue(java.lang.Object object,
java.lang.Class<T> clazz) |
<T> T |
readValue(java.lang.String json,
java.lang.Class<T> clazz)
Creates a object from a json String.
|
<T> T |
readValue(java.lang.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) |
java.lang.String |
writeValueAsString(java.lang.Object obj)
Converts a object into a String containing the json representation of this
object.
|
java.lang.String |
writeValueAsString(java.lang.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 java.lang.String writeValueAsString(java.lang.Object obj)
obj - the object to serialize into jsonpublic java.lang.String writeValueAsString(java.lang.Object obj,
boolean indent)
obj - the object to serialize into jsonindent - if false writes json on one linepublic <T> T readValue(java.lang.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(java.lang.String json,
java.lang.Class<T> clazz)
T - type of the object to createjson - String with the jsonclazz - Class of object to createpublic <T> T convertValue(java.lang.Object object,
java.lang.Class<T> clazz)
Copyright © 2010-2012. All Rights Reserved.