Package com.fauna.codec
Interface Codec<T>
-
- Type Parameters:
T
- The type of object that this codec can encode and decode.
- All Known Implementing Classes:
BaseCodec
,BaseDocumentCodec
,BaseRefCodec
,BoolCodec
,ByteArrayCodec
,ByteCodec
,CharCodec
,ClassCodec
,DoubleCodec
,DynamicCodec
,EnumCodec
,EventSourceCodec
,FloatCodec
,InstantCodec
,IntCodec
,ListCodec
,LocalDateCodec
,LongCodec
,MapCodec
,ModuleCodec
,NullableDocumentCodec
,OptionalCodec
,PageCodec
,QueryArrCodec
,QueryCodec
,QueryLiteralCodec
,QueryObjCodec
,QueryValCodec
,ShortCodec
,StringCodec
public interface Codec<T>
Interface for codecs, which handle the serialization and deserialization of specific types.Each codec is associated with a particular class and supports a set of Fauna data types.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
decode(UTF8FaunaParser parser)
Decodes an object from the providedUTF8FaunaParser
.void
encode(UTF8FaunaGenerator gen, T obj)
Encodes the specified object using the providedUTF8FaunaGenerator
.java.lang.Class<?>
getCodecClass()
Gets the class associated with this codec.FaunaType[]
getSupportedTypes()
Gets the set of supported Fauna data types for this codec.
-
-
-
Method Detail
-
decode
T decode(UTF8FaunaParser parser) throws CodecException
Decodes an object from the providedUTF8FaunaParser
.- Parameters:
parser
- The parser to use for reading and decoding the data.- Returns:
- The decoded object of type
T
. - Throws:
CodecException
- If an error occurs during decoding.
-
encode
void encode(UTF8FaunaGenerator gen, T obj) throws CodecException
Encodes the specified object using the providedUTF8FaunaGenerator
.- Parameters:
gen
- The generator to use for writing and encoding the data.obj
- The object of typeT
to encode.- Throws:
CodecException
- If an error occurs during encoding.
-
getCodecClass
java.lang.Class<?> getCodecClass()
Gets the class associated with this codec.- Returns:
- The
Class
type that this codec handles.
-
-