Class JacksonCodec
java.lang.Object
io.vertx.core.json.jackson.JacksonCodec
- All Implemented Interfaces:
JsonCodec
- Direct Known Subclasses:
DatabindCodec
- Author:
- Julien Viet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonParsercreateParser(Buffer buf) static JsonParsercreateParser(String str) static voidencodeJson(Object json, JsonGenerator generator) fromBuffer(Buffer buf) <T> TfromBuffer(Buffer json, Class<T> clazz) LikeJsonCodec.fromString(String, Class)but with a jsonBufferstatic <T> TfromParser(JsonParser parser, Class<T> type) fromString(String str) <T> TfromString(String json, Class<T> clazz) Decode the providejsonstring to an object extendingclazz.<T> TLikeJsonCodec.fromString(String, Class)but with a jsonObjectparseArray(JsonParser parser) Parse a JSON array given theparser, the parser current token must beJsonTokenId.ID_START_ARRAYparseObject(JsonParser parser) Parse a JSON object given theparser, the parser current token must beJsonTokenId.ID_START_OBJECTstatic ObjectparseValue(JsonParser parser) Parse a JSON value given theparser, consuming the current parser token and possibly more when parsing an object or an array.LikeJsonCodec.toString(Object, boolean)but with a jsonBufferEncode the specifiedobjectto a string.
-
Constructor Details
-
JacksonCodec
public JacksonCodec()
-
-
Method Details
-
fromString
Description copied from interface:JsonCodecDecode the providejsonstring to an object extendingclazz.- Specified by:
fromStringin interfaceJsonCodec- Parameters:
json- the json stringclazz- the required object's class- Returns:
- the instance
- Throws:
DecodeException- anything preventing the decoding
-
fromBuffer
Description copied from interface:JsonCodecLikeJsonCodec.fromString(String, Class)but with a jsonBuffer- Specified by:
fromBufferin interfaceJsonCodec- Throws:
DecodeException
-
fromValue
-
toString
Description copied from interface:JsonCodecEncode the specifiedobjectto a string.- Specified by:
toStringin interfaceJsonCodec- 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- Throws:
EncodeException
-
createParser
-
createParser
-
fromString
- Throws:
DecodeException
-
fromBuffer
- Throws:
DecodeException
-
fromParser
- Throws:
DecodeException
-
parseValue
Parse a JSON value given theparser, consuming the current parser token and possibly more when parsing an object or an array.- Parameters:
parser- the parser- Returns:
- the parsed value as an object
- Throws:
IOExceptionDecodeException
-
parseObject
Parse a JSON object given theparser, the parser current token must beJsonTokenId.ID_START_OBJECT- Parameters:
parser- the parser- Returns:
- the parsed object
- Throws:
IOException
-
parseArray
Parse a JSON array given theparser, the parser current token must beJsonTokenId.ID_START_ARRAY- Parameters:
parser- the parser- Returns:
- the parsed array
- Throws:
IOException
-
encodeJson
- Throws:
EncodeException
-