Class DatabindCodec
java.lang.Object
io.vertx.core.json.jackson.JacksonCodec
io.vertx.core.json.jackson.DatabindCodec
- All Implemented Interfaces:
JsonCodec
- Author:
- Julien Viet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonParsercreateParser(io.vertx.core.internal.buffer.BufferInternal buf) static JsonParsercreateParser(String str) <T> TfromBuffer(Buffer buf, TypeReference<T> typeRef) <T> TfromBuffer(Buffer buf, Class<T> clazz) LikeJsonCodec.fromString(String, Class)but with a jsonBufferstatic <T> TfromParser(JsonParser parser, Class<T> type) <T> TfromString(String str, TypeReference<T> typeRef) <T> TfromString(String str, Class<T> clazz) Decode the providejsonstring to an object extendingclazz.<T> TfromValue(Object json, TypeReference<T> type) <T> TLikeJsonCodec.fromString(String, Class)but with a jsonObjectstatic ObjectMappermapper()LikeJsonCodec.toString(Object, boolean)but with a jsonBufferEncode the specifiedobjectto a string.Methods inherited from class JacksonCodec
createParser, encodeJson, fromBuffer, fromString, parseArray, parseObject, parseValue
-
Constructor Details
-
DatabindCodec
public DatabindCodec()
-
-
Method Details
-
mapper
- Returns:
- the
ObjectMapperused for data binding.
-
fromValue
Description copied from interface:JsonCodecLikeJsonCodec.fromString(String, Class)but with a jsonObject- Specified by:
fromValuein interfaceJsonCodec- Overrides:
fromValuein classJacksonCodec
-
fromValue
-
fromString
Description copied from interface:JsonCodecDecode the providejsonstring to an object extendingclazz.- Specified by:
fromStringin interfaceJsonCodec- Overrides:
fromStringin classJacksonCodec- Parameters:
str- the json stringclazz- the required object's class- Returns:
- the instance
- Throws:
DecodeException- anything preventing the decoding
-
fromString
- Throws:
DecodeException
-
fromBuffer
Description copied from interface:JsonCodecLikeJsonCodec.fromString(String, Class)but with a jsonBuffer- Specified by:
fromBufferin interfaceJsonCodec- Overrides:
fromBufferin classJacksonCodec- Throws:
DecodeException
-
fromBuffer
- Throws:
DecodeException
-
createParser
-
createParser
-
fromParser
- Throws:
DecodeException
-
toString
Description copied from interface:JsonCodecEncode the specifiedobjectto a string.- Specified by:
toStringin interfaceJsonCodec- Overrides:
toStringin classJacksonCodec- Parameters:
object- the object to encodepretty-trueto format the string prettily- Returns:
- the json encoded string
- Throws:
EncodeException
-
toBuffer
Description copied from interface:JsonCodecLikeJsonCodec.toString(Object, boolean)but with a jsonBuffer- Specified by:
toBufferin interfaceJsonCodec- Overrides:
toBufferin classJacksonCodec- Throws:
EncodeException
-