public class JacksonCodec extends Object implements JsonCodec
| Constructor and Description |
|---|
JacksonCodec() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
<T> T |
fromBuffer(Buffer buf,
Class<T> clazz)
Like
JsonCodec.fromString(String, Class) but with a json Buffer |
static <T> T |
fromBuffer(Buffer buf,
TypeReference<T> type) |
<T> T |
fromString(String str,
Class<T> clazz)
Decode the provide
json string to an object extending clazz. |
static <T> T |
fromString(String str,
TypeReference<T> type) |
<T> T |
fromValue(Object json,
Class<T> clazz)
Like
JsonCodec.fromString(String, Class) but with a json Object |
static <T> T |
fromValue(Object json,
TypeReference<T> type) |
Buffer |
toBuffer(Object object,
boolean pretty)
Like
JsonCodec.toString(Object, boolean) but with a json Buffer |
String |
toString(Object object,
boolean pretty)
Encode the specified
object to a string. |
public <T> T fromValue(Object json, Class<T> clazz)
JsonCodecJsonCodec.fromString(String, Class) but with a json Objectpublic static <T> T fromValue(Object json, TypeReference<T> type)
public <T> T fromString(String str, Class<T> clazz) throws DecodeException
JsonCodecjson string to an object extending clazz.fromString in interface JsonCodecstr - the json stringclazz - the required object's classDecodeException - anything preventing the decodingpublic static <T> T fromString(String str, TypeReference<T> type) throws DecodeException
DecodeExceptionpublic <T> T fromBuffer(Buffer buf, Class<T> clazz) throws DecodeException
JsonCodecJsonCodec.fromString(String, Class) but with a json BufferfromBuffer in interface JsonCodecDecodeExceptionpublic static <T> T fromBuffer(Buffer buf, TypeReference<T> type) throws DecodeException
DecodeExceptionpublic 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 <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.