Interface JsonCodec
- All Known Implementing Classes:
DatabindCodec, JacksonCodec
public interface JsonCodec
- Author:
- Julien Viet
-
Method Summary
Modifier and TypeMethodDescription<T> TfromBuffer(Buffer json, Class<T> clazz) LikefromString(String, Class)but with a jsonBuffer<T> TfromString(String json, Class<T> clazz) Decode the providejsonstring to an object extendingclazz.<T> TLikefromString(String, Class)but with a jsonObjectdefault BufferLiketoString(Object)but with a jsonBufferLiketoString(Object, boolean)but with a jsonBufferdefault StringEncode the specifiedobjectto a string.Encode the specifiedobjectto a string.
-
Method Details
-
fromString
Decode the providejsonstring to an object extendingclazz.- Parameters:
json- the json stringclazz- the required object's class- Returns:
- the instance
- Throws:
DecodeException- anything preventing the decoding
-
fromBuffer
LikefromString(String, Class)but with a jsonBuffer- Throws:
DecodeException
-
fromValue
LikefromString(String, Class)but with a jsonObject -
toString
Encode the specifiedobjectto a string.- Throws:
EncodeException
-
toString
Encode the specifiedobjectto a string.- Parameters:
object- the object to encodepretty-trueto format the string prettily- Returns:
- the json encoded string
- Throws:
DecodeException- anything preventing the encodingEncodeException
-
toBuffer
LiketoString(Object, boolean)but with a jsonBuffer- Throws:
EncodeException
-
toBuffer
LiketoString(Object)but with a jsonBuffer- Throws:
EncodeException
-