Class AbstractCodec<E>
java.lang.Object
io.clonecloudstore.common.database.mongo.AbstractCodec<E>
- Type Parameters:
E
- type of DTO
- All Implemented Interfaces:
org.bson.codecs.Codec<E>
,org.bson.codecs.CollectibleCodec<E>
,org.bson.codecs.Decoder<E>
,org.bson.codecs.Encoder<E>
public abstract class AbstractCodec<E>
extends Object
implements org.bson.codecs.CollectibleCodec<E>
Abstract for Codec implementation. The getEncoderClass method, and some protected ones, are to
instantiate.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecode
(org.bson.BsonReader bsonReader, org.bson.codecs.DecoderContext decoderContext) boolean
documentHasId
(E e) void
protected abstract E
fromDocument
(org.bson.Document document) Transform the document to E (except GUID)org.bson.BsonValue
getDocumentId
(E e) protected abstract String
Get the Guid from eprotected abstract void
From e, set the given Guidprotected abstract void
toDocument
(E e, org.bson.Document document) Transform E to the document (except GUID)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bson.codecs.Encoder
getEncoderClass
-
Constructor Details
-
AbstractCodec
protected AbstractCodec()
-
-
Method Details
-
generateIdIfAbsentFromDocument
- Specified by:
generateIdIfAbsentFromDocument
in interfaceorg.bson.codecs.CollectibleCodec<E>
-
setGuid
From e, set the given Guid -
getGuid
Get the Guid from e -
documentHasId
- Specified by:
documentHasId
in interfaceorg.bson.codecs.CollectibleCodec<E>
-
getDocumentId
- Specified by:
getDocumentId
in interfaceorg.bson.codecs.CollectibleCodec<E>
-
decode
- Specified by:
decode
in interfaceorg.bson.codecs.Decoder<E>
-
fromDocument
Transform the document to E (except GUID) -
encode
public void encode(org.bson.BsonWriter bsonWriter, E e, org.bson.codecs.EncoderContext encoderContext) - Specified by:
encode
in interfaceorg.bson.codecs.Encoder<E>
-
toDocument
Transform E to the document (except GUID)
-