public class JacksonCodec extends Object implements JsonCodec
| Constructor and Description | 
|---|
| JacksonCodec() | 
| Modifier and Type | Method and Description | 
|---|---|
| static JsonParser | createParser(Buffer buf) | 
| static JsonParser | createParser(String str) | 
| static <T> T | decodeValue(Buffer buf,
           TypeReference<T> type)Decode a given JSON buffer to a POJO of the given class type. | 
| static <T> T | decodeValue(String str,
           TypeReference<T> type)Decode a given JSON string to a POJO of the given type. | 
| Object | fromBuffer(Buffer buf) | 
| <T> T | fromBuffer(Buffer json,
          Class<T> clazz)Like  JsonCodec.fromString(String, Class)but with a jsonBuffer | 
| <T> T | fromBuffer(Buffer buf,
          TypeReference<T> typeRef) | 
| static <T> T | fromParser(JsonParser parser,
          Class<T> type) | 
| Object | fromString(String str) | 
| <T> T | fromString(String json,
          Class<T> clazz)Decode the provide  jsonstring to an object extendingclazz. | 
| <T> T | fromString(String str,
          TypeReference<T> typeRef) | 
| <T> T | fromValue(Object json,
         Class<T> toValueType)Like  JsonCodec.fromString(String, Class)but with a jsonObject | 
| <T> T | fromValue(Object json,
         TypeReference<T> type) | 
| Buffer | toBuffer(Object object,
        boolean pretty)Like  JsonCodec.toString(Object, boolean)but with a jsonBuffer | 
| String | toString(Object object,
        boolean pretty)Encode the specified  objectto a string. | 
public <T> T fromString(String json, Class<T> clazz) throws DecodeException
JsonCodecjson string to an object extending clazz.fromString in interface JsonCodecjson - the json stringclazz - the required object's classDecodeException - anything preventing the decodingpublic <T> T fromString(String str, TypeReference<T> typeRef) throws DecodeException
DecodeExceptionpublic <T> T fromBuffer(Buffer json, Class<T> clazz) throws DecodeException
JsonCodecJsonCodec.fromString(String, Class) but with a json BufferfromBuffer in interface JsonCodecDecodeExceptionpublic <T> T fromBuffer(Buffer buf, TypeReference<T> typeRef) throws DecodeException
DecodeExceptionpublic <T> T fromValue(Object json, Class<T> toValueType)
JsonCodecJsonCodec.fromString(String, Class) but with a json Objectpublic <T> T fromValue(Object json, TypeReference<T> type)
public String toString(Object object, boolean pretty) throws EncodeException
JsonCodecobject to a string.toString in interface JsonCodecobject - the object to encodepretty - true to format the string prettilyEncodeExceptionpublic Buffer toBuffer(Object object, boolean pretty) throws EncodeException
JsonCodecJsonCodec.toString(Object, boolean) but with a json BuffertoBuffer in interface JsonCodecEncodeExceptionpublic static JsonParser createParser(String str)
public static JsonParser createParser(Buffer buf)
public Object fromString(String str) throws DecodeException
DecodeExceptionpublic Object fromBuffer(Buffer buf) throws DecodeException
DecodeExceptionpublic static <T> T fromParser(JsonParser parser, Class<T> type) throws DecodeException
DecodeExceptionpublic static <T> T decodeValue(String str, TypeReference<T> type) throws DecodeException
T - the generic type.str - the JSON string.type - the type to map to.DecodeException - when there is a parsing or invalid mapping.public static <T> T decodeValue(Buffer buf, TypeReference<T> type) throws DecodeException
T - the generic type.buf - the JSON buffer.type - the type to map to.DecodeException - when there is a parsing or invalid mapping.Copyright © 2021 Eclipse. All rights reserved.