Package com.fauna.codec.codecs
Class BaseDocumentCodec
- java.lang.Object
-
- com.fauna.codec.codecs.BaseCodec<BaseDocument>
-
- com.fauna.codec.codecs.BaseDocumentCodec
-
- All Implemented Interfaces:
Codec<BaseDocument>
public final class BaseDocumentCodec extends BaseCodec<BaseDocument>
Codec for encoding and decoding FQLBaseDocument
instances.
-
-
Constructor Summary
Constructors Constructor Description BaseDocumentCodec(CodecProvider provider)
Constructs aBaseDocumentCodec
with the specified codec provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseDocument
decode(UTF8FaunaParser parser)
Decodes an object from the providedUTF8FaunaParser
.void
encode(UTF8FaunaGenerator gen, BaseDocument obj)
Encodes the specified object using the providedUTF8FaunaGenerator
.java.lang.Class<BaseDocument>
getCodecClass()
Gets the class associated with this codec.FaunaType[]
getSupportedTypes()
Gets the set of supported Fauna data types for this codec.-
Methods inherited from class com.fauna.codec.codecs.BaseCodec
unexpectedTokenExceptionMessage, unexpectedTypeWhileDecoding, unsupportedTypeDecodingMessage, unsupportedTypeMessage
-
-
-
-
Constructor Detail
-
BaseDocumentCodec
public BaseDocumentCodec(CodecProvider provider)
Constructs aBaseDocumentCodec
with the specified codec provider.- Parameters:
provider
- the codec provider
-
-
Method Detail
-
decode
public BaseDocument decode(UTF8FaunaParser parser) throws CodecException
Description copied from interface:Codec
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
public void encode(UTF8FaunaGenerator gen, BaseDocument obj) throws CodecException
Description copied from interface:Codec
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
public java.lang.Class<BaseDocument> getCodecClass()
Description copied from interface:Codec
Gets the class associated with this codec.- Returns:
- The
Class
type that this codec handles.
-
-