public class DatabindCodec extends JacksonCodec
Constructor and Description |
---|
DatabindCodec() |
Modifier and Type | Method and Description |
---|---|
static JsonParser |
createParser(Buffer buf) |
static JsonParser |
createParser(String str) |
<T> T |
fromBuffer(Buffer buf,
Class<T> clazz)
Like
JsonCodec.fromString(String, Class) but with a json Buffer |
<T> T |
fromBuffer(Buffer buf,
TypeReference<T> typeRef) |
static <T> T |
fromParser(JsonParser parser,
Class<T> type) |
<T> T |
fromString(String str,
Class<T> clazz)
Decode the provide
json string to an object extending clazz . |
<T> T |
fromString(String str,
TypeReference<T> typeRef) |
<T> T |
fromValue(Object json,
Class<T> clazz)
Like
JsonCodec.fromString(String, Class) but with a json Object |
<T> T |
fromValue(Object json,
TypeReference<T> type) |
static ObjectMapper |
mapper() |
static ObjectMapper |
prettyMapper() |
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. |
decodeValue, decodeValue, fromBuffer, fromString
public static ObjectMapper mapper()
ObjectMapper
used for data binding.public static ObjectMapper prettyMapper()
ObjectMapper
used for data binding configured for indenting output.public <T> T fromValue(Object json, Class<T> clazz)
JsonCodec
JsonCodec.fromString(String, Class)
but with a json Object
fromValue
in interface JsonCodec
fromValue
in class JacksonCodec
public <T> T fromValue(Object json, TypeReference<T> type)
fromValue
in class JacksonCodec
public <T> T fromString(String str, Class<T> clazz) throws DecodeException
JsonCodec
json
string to an object extending clazz
.fromString
in interface JsonCodec
fromString
in class JacksonCodec
str
- the json stringclazz
- the required object's classDecodeException
- anything preventing the decodingpublic <T> T fromString(String str, TypeReference<T> typeRef) throws DecodeException
fromString
in class JacksonCodec
DecodeException
public <T> T fromBuffer(Buffer buf, Class<T> clazz) throws DecodeException
JsonCodec
JsonCodec.fromString(String, Class)
but with a json Buffer
fromBuffer
in interface JsonCodec
fromBuffer
in class JacksonCodec
DecodeException
public <T> T fromBuffer(Buffer buf, TypeReference<T> typeRef) throws DecodeException
fromBuffer
in class JacksonCodec
DecodeException
public static JsonParser createParser(Buffer buf)
public static JsonParser createParser(String str)
public static <T> T fromParser(JsonParser parser, Class<T> type) throws DecodeException
DecodeException
public String toString(Object object, boolean pretty) throws EncodeException
JsonCodec
object
to a string.toString
in interface JsonCodec
toString
in class JacksonCodec
object
- the object to encodepretty
- true
to format the string prettilyEncodeException
public Buffer toBuffer(Object object, boolean pretty) throws EncodeException
JsonCodec
JsonCodec.toString(Object, boolean)
but with a json Buffer
toBuffer
in interface JsonCodec
toBuffer
in class JacksonCodec
EncodeException
Copyright © 2023 Eclipse. All rights reserved.