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 com.fasterxml.jackson.core.JsonParsercreateParser(io.vertx.core.internal.buffer.BufferInternal buf) static com.fasterxml.jackson.core.JsonParsercreateParser(String str) <T> TfromBuffer(Buffer buf, com.fasterxml.jackson.core.type.TypeReference<T> typeRef) <T> TfromBuffer(Buffer buf, Class<T> clazz) LikeJsonCodec.fromString(String, Class)but with a jsonBufferstatic <T> TfromParser(com.fasterxml.jackson.core.JsonParser parser, Class<T> type) <T> TfromString(String str, com.fasterxml.jackson.core.type.TypeReference<T> typeRef) <T> TfromString(String str, Class<T> clazz) Decode the providejsonstring to an object extendingclazz.<T> T<T> TLikeJsonCodec.fromString(String, Class)but with a jsonObjectstatic com.fasterxml.jackson.databind.ObjectMappermapper()LikeJsonCodec.toString(Object, boolean)but with a jsonBufferEncode the specifiedobjectto a string.Methods inherited from class io.vertx.core.json.jackson.JacksonCodec
createParser, encodeJson, fromBuffer, fromString, parseArray, parseObject, parseValue
-
Constructor Details
-
DatabindCodec
public DatabindCodec()
-
-
Method Details
-
mapper
public static com.fasterxml.jackson.databind.ObjectMapper 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
public <T> T fromString(String str, com.fasterxml.jackson.core.type.TypeReference<T> typeRef) throws DecodeException - 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
public <T> T fromBuffer(Buffer buf, com.fasterxml.jackson.core.type.TypeReference<T> typeRef) throws DecodeException - Throws:
DecodeException
-
createParser
public static com.fasterxml.jackson.core.JsonParser createParser(io.vertx.core.internal.buffer.BufferInternal buf) -
createParser
-
fromParser
public static <T> T fromParser(com.fasterxml.jackson.core.JsonParser parser, Class<T> type) throws DecodeException - 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
-