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) booleandocumentHasId(E e) voidprotected abstract EfromDocument(org.bson.Document document) Transform the document to E (except GUID)org.bson.BsonValuegetDocumentId(E e) protected abstract StringGet the Guid from eprotected abstract voidFrom e, set the given Guidprotected abstract voidtoDocument(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, waitMethods inherited from interface org.bson.codecs.Encoder
getEncoderClass
-
Constructor Details
-
AbstractCodec
protected AbstractCodec()
-
-
Method Details
-
generateIdIfAbsentFromDocument
- Specified by:
generateIdIfAbsentFromDocumentin interfaceorg.bson.codecs.CollectibleCodec<E>
-
setGuid
From e, set the given Guid -
getGuid
Get the Guid from e -
documentHasId
- Specified by:
documentHasIdin interfaceorg.bson.codecs.CollectibleCodec<E>
-
getDocumentId
- Specified by:
getDocumentIdin interfaceorg.bson.codecs.CollectibleCodec<E>
-
decode
- Specified by:
decodein 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:
encodein interfaceorg.bson.codecs.Encoder<E>
-
toDocument
Transform E to the document (except GUID)
-