public class LazyBSONCallback extends EmptyBSONCallback
BSONCallback
for creation of LazyBSONObject
and LazyBSONList
instances.Constructor and Description |
---|
LazyBSONCallback() |
Modifier and Type | Method and Description |
---|---|
java.util.List |
createArray(byte[] bytes,
int offset)
Create a
LazyBSONList from the given bytes starting from the given offset. |
java.lang.Object |
createDBRef(java.lang.String ns,
ObjectId id)
This is a factory method pattern to create appropriate objects for BSON type DBPointer(0x0c).
|
java.lang.Object |
createObject(byte[] bytes,
int offset)
Create a
LazyBSONObject instance from the given bytes starting from the given offset. |
java.lang.Object |
get()
Returns the finished top-level Document.
|
void |
gotBinary(java.lang.String name,
byte type,
byte[] data)
Called when reading a field with a
BsonType.BINARY value. |
void |
reset()
Resets the callback, clearing all state.
|
arrayDone, arrayStart, arrayStart, createBSONCallback, gotBinaryArray, gotBoolean, gotCode, gotCodeWScope, gotDate, gotDBRef, gotDecimal128, gotDouble, gotInt, gotLong, gotMaxKey, gotMinKey, gotNull, gotObjectId, gotRegex, gotString, gotSymbol, gotTimestamp, gotUndefined, gotUUID, objectDone, objectStart, objectStart
public void reset()
BSONCallback
reset
in interface BSONCallback
reset
in class EmptyBSONCallback
public java.lang.Object get()
BSONCallback
get
in interface BSONCallback
get
in class EmptyBSONCallback
public void gotBinary(java.lang.String name, byte type, byte[] data)
BSONCallback
BsonType.BINARY
value. Note that binary values have a subtype, which may
determine how the value is processed.gotBinary
in interface BSONCallback
gotBinary
in class EmptyBSONCallback
name
- the name of the fieldtype
- one of the binary subtypes: BsonBinarySubType
data
- the field's valuepublic java.lang.Object createObject(byte[] bytes, int offset)
LazyBSONObject
instance from the given bytes starting from the given offset.bytes
- the raw BSON bytesoffset
- the offset into the bytespublic java.util.List createArray(byte[] bytes, int offset)
LazyBSONList
from the given bytes starting from the given offset.bytes
- the raw BSON bytesoffset
- the offset into the bytespublic java.lang.Object createDBRef(java.lang.String ns, ObjectId id)
ns
- the namespace of the referenceid
- the identifier of the reference