Package org.bson
Class LazyBSONCallback
- java.lang.Object
-
- org.bson.EmptyBSONCallback
-
- org.bson.LazyBSONCallback
-
- All Implemented Interfaces:
BSONCallback
- Direct Known Subclasses:
LazyDBCallback
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 java.util.List
createArray(byte[] bytes, int offset)
Create aLazyBSONList
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 aLazyBSONObject
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 aBsonType.BINARY
value.void
reset()
Resets the callback, clearing all state.-
Methods inherited from class org.bson.EmptyBSONCallback
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
-
-
-
-
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 java.lang.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(java.lang.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 java.lang.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 java.util.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
-
createDBRef
public 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).- Parameters:
ns
- the namespace of the referenceid
- the identifier of the reference- Returns:
- object to be used as reference representation
-
-