@groovy.transform.CompileStatic class BsonPersistentEntityCodec extends java.lang.Object implements Codec
Encodes and decodes PersistentEntity objects from a BSON stream
| Modifiers | Name | Description |
|---|---|---|
static DecoderContext |
DEFAULT_DECODER_CONTEXT |
|
static EncoderContext |
DEFAULT_ENCODER_CONTEXT |
| Type | Name and description |
|---|---|
CodecRegistry |
codecRegistry |
PersistentEntity |
entity |
MappingContext |
mappingContext |
boolean |
stateful |
| Constructor and description |
|---|
BsonPersistentEntityCodec
(CodecRegistry codecRegistry, PersistentEntity entity, boolean stateful) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
beforeFinishDocument(BsonWriter bsonWriter, EntityAccess access)Called directly before the last call to finish the document writing process |
|
protected EntityAccess |
createEntityAccess(java.lang.Object instance) |
|
protected EntityAccess |
createEntityAccess(PersistentEntity entity, java.lang.Object instance) |
|
java.lang.Object |
decode(BsonReader bsonReader, DecoderContext decoderContext) |
|
void |
encode(BsonWriter writer, java.lang.Object value, EncoderContext encoderContext) |
|
void |
encode(BsonWriter writer, java.lang.Object value, EncoderContext encoderContext, boolean includeIdentifier) |
|
Bson |
encodeUpdate(java.lang.Object value, EntityAccess access, EncoderContext encoderContext, boolean embedded)This method will encode an update for the given object based |
|
protected java.lang.String |
getDiscriminatorAttributeName()
|
|
java.lang.Class |
getEncoderClass() |
<T extends PersistentProperty> |
protected PropertyDecoder<T> |
getPropertyDecoder(java.lang.Class<T> type)Obtains the property encoder for the given property type |
<T extends PersistentProperty> |
protected PropertyEncoder<T> |
getPropertyEncoder(java.lang.Class<T> type)Obtains the property encoder for the given property type |
|
protected boolean |
isDiscriminatorProperty(java.lang.String name) |
|
protected boolean |
isIdentifierProperty(java.lang.String name)Whether the given document attribute is the identifier |
|
protected void |
readSchemaless(BsonReader bsonReader, DynamicAttributes dynamicAttributes, java.lang.String name, DecoderContext decoderContext)Reads an undeclared property |
|
protected void |
readingComplete(EntityAccess access)Called when reading from a BsonReader is completed |
|
static void |
registerDecoder(java.lang.Class<? extends PersistentProperty> type, PropertyDecoder propertyDecoder) |
|
static void |
registerEncoder(java.lang.Class<? extends PersistentProperty> type, PropertyEncoder propertyEncoder) |
|
protected java.lang.Object |
retrieveCachedInstance(EntityAccess access)Retrieve a cached instance if any |
|
protected void |
writeAttributes(java.util.Map<java.lang.String, java.lang.Object> attributes, BsonWriter writer, EncoderContext encoderContext)Writes the dynamic attributes to the writer |
|
protected void |
writingComplete(EntityAccess entityAccess)Called when the document is fully written from the source entity |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Called directly before the last call to finish the document writing process
bsonWriter - The BsonWriteraccess - The entity accessThis method will encode an update for the given object based
value - A org.bson.conversions.Bson that is the update object
Obtains the property encoder for the given property type
type - The property encoder typeObtains the property encoder for the given property type
type - The property encoder typeWhether the given document attribute is the identifier
name - The name of the document attributeReads an undeclared property
bsonReader - The bson readerdynamicAttributes - a document of undeclared propertiesCalled when reading from a BsonReader is completed
access - the accessRetrieve a cached instance if any
access - The entity accessWrites the dynamic attributes to the writer
attributes - The dynamic attributeswriter - The writerCalled when the document is fully written from the source entity
entityAccess - Access to the entityGroovy Documentation