@groovy.transform.CompileStatic class BsonPersistentEntityCodec extends java.lang.Object implements org.bson.codecs.Codec
Encodes and decodes PersistentEntity objects from a BSON stream
Modifiers | Name | Description |
---|---|---|
private static java.util.Map<java.lang.Class<? extends PersistentProperty>, PropertyDecoder> |
DECODERS |
|
static org.bson.codecs.DecoderContext |
DEFAULT_DECODER_CONTEXT |
|
static org.bson.codecs.EncoderContext |
DEFAULT_ENCODER_CONTEXT |
|
private static java.util.Map<java.lang.Class<? extends PersistentProperty>, PropertyEncoder> |
ENCODERS |
|
private org.bson.codecs.configuration.CodecRegistry |
codecRegistry |
|
private PersistentEntity |
entity |
|
private MappingContext |
mappingContext |
|
private boolean |
stateful |
Type | Name and description |
---|---|
org.bson.codecs.configuration.CodecRegistry |
codecRegistry |
PersistentEntity |
entity |
MappingContext |
mappingContext |
boolean |
stateful |
Constructor and description |
---|
BsonPersistentEntityCodec
(org.bson.codecs.configuration.CodecRegistry codecRegistry, PersistentEntity entity, boolean stateful) |
Type Params | Return Type | Name and description |
---|---|---|
|
static void |
|
|
protected void |
beforeFinishDocument(org.bson.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(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, 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, DynamicAttributes dynamicAttributes, java.lang.String name, org.bson.codecs.DecoderContext decoderContext) Reads an undeclared property |
|
protected void |
readingComplete(EntityAccess access) Called when reading from a org.bson.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, org.bson.BsonWriter writer, org.bson.codecs.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), java.lang.Object#wait(long, int), 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 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