Package com.mongodb
Class DefaultDBEncoder
- java.lang.Object
-
- org.bson.BasicBSONEncoder
-
- com.mongodb.DefaultDBEncoder
-
- All Implemented Interfaces:
DBEncoder
,BSONEncoder
public class DefaultDBEncoder extends BasicBSONEncoder implements DBEncoder
The default BSON encoder for BSONObject instances.
-
-
Field Summary
Fields Modifier and Type Field Description static DBEncoderFactory
FACTORY
-
Constructor Summary
Constructors Constructor Description DefaultDBEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
putDBRef(String name, DBRef ref)
Deals with encoding database references.protected boolean
putSpecial(String name, Object value)
Special values are not encoded into documents.String
toString()
int
writeObject(OutputBuffer outputBuffer, BSONObject document)
Encode the BSONObject.-
Methods inherited from class org.bson.BasicBSONEncoder
_putObjectField, done, encode, getBsonWriter, getOutputBuffer, putArray, putBinary, putBinary, putBoolean, putCode, putCodeWScope, putDate, putDecimal128, putIterable, putMap, putMaxKey, putMinKey, putName, putNull, putNumber, putObject, putObject, putObjectId, putPattern, putString, putSymbol, putTimestamp, putUndefined, putUUID, set
-
-
-
-
Field Detail
-
FACTORY
public static final DBEncoderFactory FACTORY
-
-
Method Detail
-
writeObject
public int writeObject(OutputBuffer outputBuffer, BSONObject document)
Description copied from interface:DBEncoder
Encode the BSONObject.- Specified by:
writeObject
in interfaceDBEncoder
- Parameters:
outputBuffer
- the OutputBuffer to write todocument
- the BSONObject to write- Returns:
- the number of characters in the encoding
-
putSpecial
protected boolean putSpecial(String name, Object value)
Description copied from class:BasicBSONEncoder
Special values are not encoded into documents.- Overrides:
putSpecial
in classBasicBSONEncoder
- Parameters:
name
- the field namevalue
- the value- Returns:
- true if the operation is successful. This implementation always returns false.
-
putDBRef
protected void putDBRef(String name, DBRef ref)
Deals with encoding database references.- Parameters:
name
- the name of the field in the documentref
- the database reference object
-
-