Package com.couchbase.client.java.codec
Class DefaultJsonSerializer
java.lang.Object
com.couchbase.client.java.codec.DefaultJsonSerializer
- All Implemented Interfaces:
JsonSerializer
The default JSON serializer.
- See Also:
- Implementation Note:
- The serializer is backed by a repackaged version of Jackson,
but this is an implementation detail that users should not depend on.
Be aware that this serializer does not recognize standard Jackson annotations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultJsonSerializer
create()
Creates an instance without encryption support.static DefaultJsonSerializer
create
(CryptoManager cryptoManager) Creates an instance with optional encryption support.<T> T
deserialize
(TypeRef<T> target, byte[] input) Deserializes raw input into the target type.<T> T
deserialize
(Class<T> target, byte[] input) Deserializes raw input into the target class.byte[]
Serializes the given input into its encoded byte array form.
-
Method Details
-
create
Creates an instance without encryption support.- Returns:
- the default JSON serializer without encryption support.
-
create
Creates an instance with optional encryption support.- Parameters:
cryptoManager
- (nullable) The manager to use for activating theEncrypted
annotation, or null to disable encryption support.- Returns:
- the default JSON serializer with encryption support.
-
serialize
Description copied from interface:JsonSerializer
Serializes the given input into its encoded byte array form.- Specified by:
serialize
in interfaceJsonSerializer
- Parameters:
input
- the object as input.- Returns:
- the serialized output.
-
deserialize
Description copied from interface:JsonSerializer
Deserializes raw input into the target class.- Specified by:
deserialize
in interfaceJsonSerializer
- Type Parameters:
T
- the generic type to deserialize into.- Parameters:
target
- the target class.input
- the raw input.- Returns:
- the deserialized output.
-
deserialize
Description copied from interface:JsonSerializer
Deserializes raw input into the target type.- Specified by:
deserialize
in interfaceJsonSerializer
- Type Parameters:
T
- the type to deserialize into.- Parameters:
target
- the target type.input
- the raw input.- Returns:
- the deserialized output.
-