Package org.bson
Class LazyBSONCallback
- java.lang.Object
-
- org.bson.EmptyBSONCallback
-
- org.bson.LazyBSONCallback
-
- All Implemented Interfaces:
BSONCallback
public class LazyBSONCallback extends EmptyBSONCallback
ABSONCallback
for creation ofLazyBSONObject
andLazyBSONList
instances.
-
-
Constructor Summary
Constructors Constructor Description LazyBSONCallback()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List
createArray(byte[] bytes, int offset)
Create aLazyBSONList
from the given bytes starting from the given offset.Object
createDBRef(String ns, ObjectId id)
This is a factory method pattern to create appropriate objects for BSON type DBPointer(0x0c).Object
createObject(byte[] bytes, int offset)
Create aLazyBSONObject
instance from the given bytes starting from the given offset.Object
get()
Returns the finished top-level Document.void
gotBinary(String name, byte type, byte[] data)
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
-
-
-
-
Method Detail
-
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
public Object 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
public void gotBinary(String name, byte type, byte[] data)
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
public Object createObject(byte[] bytes, int offset)
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
public List createArray(byte[] bytes, int offset)
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
-
-