Package dev.morphia.mapping.codec.writer
Class DocumentWriter
- java.lang.Object
-
- dev.morphia.mapping.codec.writer.DocumentWriter
-
- All Implemented Interfaces:
org.bson.BsonWriter
public class DocumentWriter extends Object implements org.bson.BsonWriter
Utility to write out to a DocumentDeveloper note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Constructor Summary
Constructors Constructor Description DocumentWriter(Mapper mapper)
Creates a new WriterDocumentWriter(Mapper mapper, org.bson.Document seed)
Creates a new Writer with a seeded Document
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentWriter
encode(org.bson.codecs.configuration.CodecRegistry codecRegistry, Object value, org.bson.codecs.EncoderContext encoderContext)
Encodes a value in to this Writervoid
flush()
org.bson.Document
getDocument()
void
pipe(org.bson.BsonReader reader)
dev.morphia.mapping.codec.writer.WriteState
state()
String
toString()
void
writeBinaryData(String name, org.bson.BsonBinary binary)
void
writeBinaryData(org.bson.BsonBinary binary)
void
writeBoolean(boolean value)
void
writeBoolean(String name, boolean value)
void
writeDateTime(long value)
void
writeDateTime(String name, long value)
void
writeDBPointer(String name, org.bson.BsonDbPointer value)
void
writeDBPointer(org.bson.BsonDbPointer value)
void
writeDecimal128(String name, org.bson.types.Decimal128 value)
void
writeDecimal128(org.bson.types.Decimal128 value)
void
writeDouble(double value)
void
writeDouble(String name, double value)
void
writeEndArray()
void
writeEndDocument()
void
writeInt32(int value)
void
writeInt32(String name, int value)
void
writeInt64(long value)
void
writeInt64(String name, long value)
void
writeJavaScript(String code)
void
writeJavaScript(String name, String code)
void
writeJavaScriptWithScope(String code)
void
writeJavaScriptWithScope(String name, String code)
void
writeMaxKey()
void
writeMaxKey(String name)
void
writeMinKey()
void
writeMinKey(String name)
void
writeName(String name)
void
writeNull()
void
writeNull(String name)
void
writeObjectId(String name, org.bson.types.ObjectId objectId)
void
writeObjectId(org.bson.types.ObjectId objectId)
void
writeRegularExpression(String name, org.bson.BsonRegularExpression regularExpression)
void
writeRegularExpression(org.bson.BsonRegularExpression regularExpression)
void
writeStartArray()
void
writeStartArray(String name)
void
writeStartDocument()
void
writeStartDocument(String name)
void
writeString(String value)
void
writeString(String name, String value)
void
writeSymbol(String value)
void
writeSymbol(String name, String value)
void
writeTimestamp(String name, org.bson.BsonTimestamp value)
void
writeTimestamp(org.bson.BsonTimestamp value)
void
writeUndefined()
void
writeUndefined(String name)
-
-
-
Constructor Detail
-
DocumentWriter
public DocumentWriter(Mapper mapper)
Creates a new Writer- Parameters:
mapper
- the mapper to use
-
DocumentWriter
public DocumentWriter(Mapper mapper, org.bson.Document seed)
Creates a new Writer with a seeded Document- Parameters:
mapper
- the mapper to useseed
- the seed Document
-
-
Method Detail
-
encode
public DocumentWriter encode(org.bson.codecs.configuration.CodecRegistry codecRegistry, Object value, org.bson.codecs.EncoderContext encoderContext)
Encodes a value in to this Writer- Parameters:
codecRegistry
- the registry to usevalue
- the value to encodeencoderContext
- the context- Returns:
- this
-
flush
public void flush()
- Specified by:
flush
in interfaceorg.bson.BsonWriter
-
getDocument
public org.bson.Document getDocument()
- Returns:
- the root, or output, of this writer. usually a Document.
-
state
public dev.morphia.mapping.codec.writer.WriteState state()
-
writeBinaryData
public void writeBinaryData(org.bson.BsonBinary binary)
- Specified by:
writeBinaryData
in interfaceorg.bson.BsonWriter
-
writeBinaryData
public void writeBinaryData(String name, org.bson.BsonBinary binary)
- Specified by:
writeBinaryData
in interfaceorg.bson.BsonWriter
-
writeBoolean
public void writeBoolean(boolean value)
- Specified by:
writeBoolean
in interfaceorg.bson.BsonWriter
-
writeBoolean
public void writeBoolean(String name, boolean value)
- Specified by:
writeBoolean
in interfaceorg.bson.BsonWriter
-
writeDateTime
public void writeDateTime(long value)
- Specified by:
writeDateTime
in interfaceorg.bson.BsonWriter
-
writeDateTime
public void writeDateTime(String name, long value)
- Specified by:
writeDateTime
in interfaceorg.bson.BsonWriter
-
writeDBPointer
public void writeDBPointer(org.bson.BsonDbPointer value)
- Specified by:
writeDBPointer
in interfaceorg.bson.BsonWriter
-
writeDBPointer
public void writeDBPointer(String name, org.bson.BsonDbPointer value)
- Specified by:
writeDBPointer
in interfaceorg.bson.BsonWriter
-
writeDouble
public void writeDouble(double value)
- Specified by:
writeDouble
in interfaceorg.bson.BsonWriter
-
writeDouble
public void writeDouble(String name, double value)
- Specified by:
writeDouble
in interfaceorg.bson.BsonWriter
-
writeEndArray
public void writeEndArray()
- Specified by:
writeEndArray
in interfaceorg.bson.BsonWriter
-
writeEndDocument
public void writeEndDocument()
- Specified by:
writeEndDocument
in interfaceorg.bson.BsonWriter
-
writeInt32
public void writeInt32(int value)
- Specified by:
writeInt32
in interfaceorg.bson.BsonWriter
-
writeInt32
public void writeInt32(String name, int value)
- Specified by:
writeInt32
in interfaceorg.bson.BsonWriter
-
writeInt64
public void writeInt64(long value)
- Specified by:
writeInt64
in interfaceorg.bson.BsonWriter
-
writeInt64
public void writeInt64(String name, long value)
- Specified by:
writeInt64
in interfaceorg.bson.BsonWriter
-
writeDecimal128
public void writeDecimal128(org.bson.types.Decimal128 value)
- Specified by:
writeDecimal128
in interfaceorg.bson.BsonWriter
-
writeDecimal128
public void writeDecimal128(String name, org.bson.types.Decimal128 value)
- Specified by:
writeDecimal128
in interfaceorg.bson.BsonWriter
-
writeJavaScript
public void writeJavaScript(String code)
- Specified by:
writeJavaScript
in interfaceorg.bson.BsonWriter
-
writeMaxKey
public void writeMaxKey(String name)
- Specified by:
writeMaxKey
in interfaceorg.bson.BsonWriter
-
writeJavaScript
public void writeJavaScript(String name, String code)
- Specified by:
writeJavaScript
in interfaceorg.bson.BsonWriter
-
writeMinKey
public void writeMinKey(String name)
- Specified by:
writeMinKey
in interfaceorg.bson.BsonWriter
-
writeJavaScriptWithScope
public void writeJavaScriptWithScope(String code)
- Specified by:
writeJavaScriptWithScope
in interfaceorg.bson.BsonWriter
-
writeJavaScriptWithScope
public void writeJavaScriptWithScope(String name, String code)
- Specified by:
writeJavaScriptWithScope
in interfaceorg.bson.BsonWriter
-
writeMaxKey
public void writeMaxKey()
- Specified by:
writeMaxKey
in interfaceorg.bson.BsonWriter
-
writeMinKey
public void writeMinKey()
- Specified by:
writeMinKey
in interfaceorg.bson.BsonWriter
-
writeName
public void writeName(String name)
- Specified by:
writeName
in interfaceorg.bson.BsonWriter
-
writeNull
public void writeNull()
- Specified by:
writeNull
in interfaceorg.bson.BsonWriter
-
writeNull
public void writeNull(String name)
- Specified by:
writeNull
in interfaceorg.bson.BsonWriter
-
writeObjectId
public void writeObjectId(org.bson.types.ObjectId objectId)
- Specified by:
writeObjectId
in interfaceorg.bson.BsonWriter
-
writeStartArray
public void writeStartArray(String name)
- Specified by:
writeStartArray
in interfaceorg.bson.BsonWriter
-
writeObjectId
public void writeObjectId(String name, org.bson.types.ObjectId objectId)
- Specified by:
writeObjectId
in interfaceorg.bson.BsonWriter
-
writeRegularExpression
public void writeRegularExpression(org.bson.BsonRegularExpression regularExpression)
- Specified by:
writeRegularExpression
in interfaceorg.bson.BsonWriter
-
writeRegularExpression
public void writeRegularExpression(String name, org.bson.BsonRegularExpression regularExpression)
- Specified by:
writeRegularExpression
in interfaceorg.bson.BsonWriter
-
writeStartArray
public void writeStartArray()
- Specified by:
writeStartArray
in interfaceorg.bson.BsonWriter
-
writeStartDocument
public void writeStartDocument()
- Specified by:
writeStartDocument
in interfaceorg.bson.BsonWriter
-
writeSymbol
public void writeSymbol(String name, String value)
- Specified by:
writeSymbol
in interfaceorg.bson.BsonWriter
-
writeStartDocument
public void writeStartDocument(String name)
- Specified by:
writeStartDocument
in interfaceorg.bson.BsonWriter
-
writeString
public void writeString(String value)
- Specified by:
writeString
in interfaceorg.bson.BsonWriter
-
writeString
public void writeString(String name, String value)
- Specified by:
writeString
in interfaceorg.bson.BsonWriter
-
writeUndefined
public void writeUndefined(String name)
- Specified by:
writeUndefined
in interfaceorg.bson.BsonWriter
-
pipe
public void pipe(org.bson.BsonReader reader)
- Specified by:
pipe
in interfaceorg.bson.BsonWriter
-
writeSymbol
public void writeSymbol(String value)
- Specified by:
writeSymbol
in interfaceorg.bson.BsonWriter
-
writeTimestamp
public void writeTimestamp(org.bson.BsonTimestamp value)
- Specified by:
writeTimestamp
in interfaceorg.bson.BsonWriter
-
writeTimestamp
public void writeTimestamp(String name, org.bson.BsonTimestamp value)
- Specified by:
writeTimestamp
in interfaceorg.bson.BsonWriter
-
writeUndefined
public void writeUndefined()
- Specified by:
writeUndefined
in interfaceorg.bson.BsonWriter
-
-