Package org.bson
Class LazyBSONCallback
java.lang.Object
org.bson.EmptyBSONCallback
org.bson.LazyBSONCallback
- All Implemented Interfaces:
BSONCallback
A
BSONCallback
for creation of LazyBSONObject
and LazyBSONList
instances.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateArray
(byte[] bytes, int offset) Create aLazyBSONList
from the given bytes starting from the given offset.createDBRef
(String ns, ObjectId id) This is a factory method pattern to create appropriate objects for BSON type DBPointer(0x0c).createObject
(byte[] bytes, int offset) Create aLazyBSONObject
instance from the given bytes starting from the given offset.get()
Returns the finished top-level Document.void
Called when reading a field with aBsonType.BINARY
value.void
reset()
Resets the callback, clearing all state.Methods inherited from class org.bson.EmptyBSONCallback
arrayDone, arrayStart, arrayStart, createBSONCallback, gotBoolean, gotCode, gotCodeWScope, gotDate, gotDBRef, gotDecimal128, gotDouble, gotInt, gotLong, gotMaxKey, gotMinKey, gotNull, gotObjectId, gotRegex, gotString, gotSymbol, gotTimestamp, gotUndefined, gotUUID, objectDone, objectStart, objectStart
-
Constructor Details
-
LazyBSONCallback
public LazyBSONCallback()
-
-
Method Details
-
reset
public void reset()Description copied from interface:BSONCallback
Resets the callback, clearing all state.- Specified by:
reset
in interfaceBSONCallback
- Overrides:
reset
in classEmptyBSONCallback
-
get
Description copied from interface:BSONCallback
Returns the finished top-level Document.- Specified by:
get
in interfaceBSONCallback
- Overrides:
get
in classEmptyBSONCallback
- Returns:
- the top level document read from the database.
-
gotBinary
Description copied from interface:BSONCallback
Called when reading a field with aBsonType.BINARY
value. Note that binary values have a subtype, which may determine how the value is processed.- Specified by:
gotBinary
in interfaceBSONCallback
- Overrides:
gotBinary
in classEmptyBSONCallback
- Parameters:
name
- the name of the fieldtype
- one of the binary subtypes:BsonBinarySubType
data
- the field's value
-
createObject
Create aLazyBSONObject
instance from the given bytes starting from the given offset.- Parameters:
bytes
- the raw BSON bytesoffset
- the offset into the bytes- Returns:
- the LazyBSONObject
-
createArray
Create aLazyBSONList
from the given bytes starting from the given offset.- Parameters:
bytes
- the raw BSON bytesoffset
- the offset into the bytes- Returns:
- the LazyBSONList
-
createDBRef
This is a factory method pattern to create appropriate objects for BSON type DBPointer(0x0c).- Parameters:
ns
- the namespace of the referenceid
- the identifier of the reference- Returns:
- object to be used as reference representation
-