@groovy.transform.CompileStatic class BsonPersistentEntityCodec extends java.lang.Object implements org.bson.codecs.Codec
Encodes and decodes org.grails.datastore.mapping.model.PersistentEntity objects from a BSON stream
| Modifiers | Name | Description |
|---|---|---|
static org.bson.codecs.DecoderContext |
DEFAULT_DECODER_CONTEXT |
|
static org.bson.codecs.EncoderContext |
DEFAULT_ENCODER_CONTEXT |
| Type | Name and description |
|---|---|
org.bson.codecs.configuration.CodecRegistry |
codecRegistry |
org.grails.datastore.mapping.model.PersistentEntity |
entity |
org.grails.datastore.mapping.model.MappingContext |
mappingContext |
boolean |
stateful |
| Constructor and description |
|---|
BsonPersistentEntityCodec(org.bson.codecs.configuration.CodecRegistry codecRegistry, org.grails.datastore.mapping.model.PersistentEntity entity, boolean stateful) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
beforeFinishDocument(org.bson.BsonWriter bsonWriter, org.grails.datastore.mapping.engine.EntityAccess access)Called directly before the last call to finish the document writing process |
|
protected org.grails.datastore.mapping.engine.EntityAccess |
createEntityAccess(java.lang.Object instance) |
|
protected org.grails.datastore.mapping.engine.EntityAccess |
createEntityAccess(org.grails.datastore.mapping.model.PersistentEntity entity, java.lang.Object instance) |
|
java.lang.Object |
decode(org.bson.BsonReader bsonReader, org.bson.codecs.DecoderContext decoderContext) |
|
void |
encode(org.bson.BsonWriter writer, java.lang.Object value, org.bson.codecs.EncoderContext encoderContext) |
|
void |
encode(org.bson.BsonWriter writer, java.lang.Object value, org.bson.codecs.EncoderContext encoderContext, boolean includeIdentifier) |
|
org.bson.conversions.Bson |
encodeUpdate(java.lang.Object value, org.grails.datastore.mapping.engine.EntityAccess access, org.bson.codecs.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(org.bson.BsonReader bsonReader, org.grails.datastore.gorm.schemaless.DynamicAttributes dynamicAttributes, java.lang.String name, org.bson.codecs.DecoderContext decoderContext)Reads an undeclared property |
|
protected void |
readingComplete(org.grails.datastore.mapping.engine.EntityAccess access)Called when reading from a org.bson.BsonReader is completed |
|
static void |
registerDecoder(java.lang.Class<? extends org.grails.datastore.mapping.model.PersistentProperty> type, PropertyDecoder propertyDecoder) |
|
static void |
registerEncoder(java.lang.Class<? extends org.grails.datastore.mapping.model.PersistentProperty> type, PropertyEncoder propertyEncoder) |
|
protected java.lang.Object |
retrieveCachedInstance(org.grails.datastore.mapping.engine.EntityAccess access)Retrieve a cached instance if any |
|
protected void |
writeAttributes(java.util.Map<java.lang.String, java.lang.Object> attributes, org.bson.BsonWriter writer, org.bson.codecs.EncoderContext encoderContext)Writes the dynamic attributes to the writer |
|
protected void |
writingComplete(org.grails.datastore.mapping.engine.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#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Called directly before the last call to finish the document writing process
bsonWriter - The org.bson.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 org.bson.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