Package io.vertx.core.json.jackson
Class DatabindCodec
- java.lang.Object
-
- io.vertx.core.json.jackson.JacksonCodec
-
- io.vertx.core.json.jackson.DatabindCodec
-
- All Implemented Interfaces:
JsonCodec
public class DatabindCodec extends JacksonCodec
- Author:
- Julien Viet
-
-
Constructor Summary
Constructors Constructor Description DatabindCodec()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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> TfromValue(Object json, Class<T> clazz)LikeJsonCodec.fromString(String, Class)but with a jsonObjectstatic ObjectMappermapper()BuffertoBuffer(Object object, boolean pretty)LikeJsonCodec.toString(Object, boolean)but with a jsonBufferStringtoString(Object object, boolean pretty)Encode the specifiedobjectto a string.-
Methods inherited from class io.vertx.core.json.jackson.JacksonCodec
createParser, encodeJson, fromBuffer, fromString
-
-
-
-
Method Detail
-
mapper
public static ObjectMapper mapper()
- Returns:
- the
ObjectMapperused for data binding.
-
fromValue
public <T> T fromValue(Object json, Class<T> clazz)
Description copied from interface:JsonCodecLikeJsonCodec.fromString(String, Class)but with a jsonObject- Specified by:
fromValuein interfaceJsonCodec- Overrides:
fromValuein classJacksonCodec
-
fromValue
public <T> T fromValue(Object json, TypeReference<T> type)
-
fromString
public <T> T fromString(String str, Class<T> clazz) throws DecodeException
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, TypeReference<T> typeRef) throws DecodeException
- Throws:
DecodeException
-
fromBuffer
public <T> T fromBuffer(Buffer buf, Class<T> clazz) throws DecodeException
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, TypeReference<T> typeRef) throws DecodeException
- Throws:
DecodeException
-
createParser
public static JsonParser createParser(io.vertx.core.internal.buffer.BufferInternal buf)
-
createParser
public static JsonParser createParser(String str)
-
fromParser
public static <T> T fromParser(JsonParser parser, Class<T> type) throws DecodeException
- Throws:
DecodeException
-
toString
public String toString(Object object, boolean pretty) throws EncodeException
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
public Buffer toBuffer(Object object, boolean pretty) throws EncodeException
Description copied from interface:JsonCodecLikeJsonCodec.toString(Object, boolean)but with a jsonBuffer- Specified by:
toBufferin interfaceJsonCodec- Overrides:
toBufferin classJacksonCodec- Throws:
EncodeException
-
-