Package org.bson.codecs
Class EncoderContext
- java.lang.Object
-
- org.bson.codecs.EncoderContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EncoderContext.Builder
A builder forEncoderContext
instances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EncoderContext.Builder
builder()
Create a builder.<T> void
encodeWithChildContext(Encoder<T> encoder, BsonWriter writer, T value)
Creates a child context based on this and serializes the value with it to the writer.EncoderContext
getChildContext()
Gets a child context based on this.boolean
isEncodingCollectibleDocument()
Returns true if the the value to be encoded is a document that will be put in a MongoDB collection.
-
-
-
Method Detail
-
builder
public static EncoderContext.Builder builder()
Create a builder.- Returns:
- the builder
-
isEncodingCollectibleDocument
public boolean isEncodingCollectibleDocument()
Returns true if the the value to be encoded is a document that will be put in a MongoDB collection. Encoders for such documents might choose to act differently when encoding such as documents, e.g. by re-ordering the fields in some way (like encoding the _id field first).- Returns:
- true if the value to be encoded is a document that will be put in a MongoDB collection
-
encodeWithChildContext
public <T> void encodeWithChildContext(Encoder<T> encoder, BsonWriter writer, T value)
Creates a child context based on this and serializes the value with it to the writer.- Type Parameters:
T
- the type of the value- Parameters:
encoder
- the encoder to encode value withwriter
- the writer to encode tovalue
- the value to encode
-
getChildContext
public EncoderContext getChildContext()
Gets a child context based on this.- Returns:
- the child context
-
-