public class BasicBSONCallback extends java.lang.Object implements BSONCallback
BsonCallback that creates an instance of BSONObject.| 构造器和说明 |
|---|
BasicBSONCallback()
Creates a new instance.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
_put(java.lang.String name,
java.lang.Object value)
Puts a new value into the document.
|
java.lang.Object |
arrayDone()
Called the end of the array, and returns the completed array.
|
void |
arrayStart()
Signals the start of a BSON array.
|
void |
arrayStart(java.lang.String name)
Signals the start of a BSON array, with its field name.
|
BSONObject |
create()
Factory method for creating a new BSONObject.
|
BSONObject |
create(boolean array,
java.util.List<java.lang.String> path)
Helper method to create either a BSON Object or a BSON List depending upon whether the
array parameter is true or not. |
BSONCallback |
createBSONCallback()
Factory method for BSONCallbacks.
|
protected BSONObject |
createList()
Factory method for creating a new BSON List.
|
protected BSONObject |
cur()
Gets the current value
|
protected java.lang.String |
curName()
Gets the name of the current field
|
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 |
gotBinaryArray(java.lang.String name,
byte[] data)
已过时。
|
void |
gotBoolean(java.lang.String name,
boolean value)
Called when reading a field with a
BsonType.BOOLEAN value. |
void |
gotCode(java.lang.String name,
java.lang.String code)
Called when reading a field with a
BsonType.JAVASCRIPT value. |
void |
gotCodeWScope(java.lang.String name,
java.lang.String code,
java.lang.Object scope)
Called when reading a field with a
BsonType.JAVASCRIPT_WITH_SCOPE value. |
void |
gotDate(java.lang.String name,
long millis)
Called when reading a field with a
BsonType.DATE_TIME value. |
void |
gotDBRef(java.lang.String name,
java.lang.String namespace,
ObjectId id)
Invoked when
BSONDecoder encountered a BsonType.DB_POINTER type field in a byte sequence. |
void |
gotDouble(java.lang.String name,
double value)
Called when reading a field with a
BsonType.DOUBLE value. |
void |
gotInt(java.lang.String name,
int value)
Called when reading a field with a
BsonType.INT32 value. |
void |
gotLong(java.lang.String name,
long value)
Called when reading a field with a
BsonType.INT64 value. |
void |
gotMaxKey(java.lang.String name)
Called when reading a field with a
BsonType.MAX_KEY value. |
void |
gotMinKey(java.lang.String name)
Called when reading a field with a
BsonType.MIN_KEY value. |
void |
gotNull(java.lang.String name)
Called when reading a BSON field that exists but has a null value.
|
void |
gotObjectId(java.lang.String name,
ObjectId id)
Called when reading a field with a
BsonType.OBJECT_ID value. |
void |
gotRegex(java.lang.String name,
java.lang.String pattern,
java.lang.String flags)
Called when reading a field with a
BsonType.REGULAR_EXPRESSION value. |
void |
gotString(java.lang.String name,
java.lang.String value)
Called when reading a field with a
BsonType.STRING value. |
void |
gotSymbol(java.lang.String name,
java.lang.String value)
Called when reading a field with a
BsonType.SYMBOL value. |
void |
gotTimestamp(java.lang.String name,
int time,
int increment)
Called when reading a field with a
BsonType.TIMESTAMP value. |
void |
gotUndefined(java.lang.String name)
Called when reading a field with a
BsonType.UNDEFINED value. |
void |
gotUUID(java.lang.String name,
long part1,
long part2)
Called when reading a field with a
UUID value. |
protected boolean |
isStackEmpty()
Returns whether this is the top level or not
|
java.lang.Object |
objectDone()
Called at the end of the document/array, and returns this object.
|
void |
objectStart()
Signals the start of a BSON document, which usually maps onto some Java object.
|
void |
objectStart(java.lang.String name)
Signals the start of a BSON document, which usually maps onto some Java object.
|
void |
reset()
Resets the callback, clearing all state.
|
protected void |
setRoot(java.lang.Object root)
Sets the root document for this position
|
public java.lang.Object get()
BSONCallbackget 在接口中 BSONCallbackpublic BSONObject create()
protected BSONObject createList()
public BSONCallback createBSONCallback()
BSONCallbackcreateBSONCallback 在接口中 BSONCallbackpublic BSONObject create(boolean array, java.util.List<java.lang.String> path)
array parameter is true or not.array - set to true to create a new BSON List, otherwise will create a new BSONObjectpath - a list of field names to navigate to this field in the documentpublic void objectStart()
BSONCallbackobjectStart 在接口中 BSONCallbackpublic void objectStart(java.lang.String name)
BSONCallbackobjectStart 在接口中 BSONCallbackname - the field name of the document.public java.lang.Object objectDone()
BSONCallbackobjectDone 在接口中 BSONCallbackpublic void arrayStart()
BSONCallbackarrayStart 在接口中 BSONCallbackpublic void arrayStart(java.lang.String name)
BSONCallbackarrayStart 在接口中 BSONCallbackname - the name of this array fieldpublic java.lang.Object arrayDone()
BSONCallbackarrayDone 在接口中 BSONCallbackpublic void gotNull(java.lang.String name)
BSONCallbackgotNull 在接口中 BSONCallbackname - the name of the fieldBsonType.NULLpublic void gotUndefined(java.lang.String name)
BSONCallbackBsonType.UNDEFINED value.gotUndefined 在接口中 BSONCallbackname - the name of the fieldBsonType.UNDEFINEDpublic void gotMinKey(java.lang.String name)
BSONCallbackBsonType.MIN_KEY value.gotMinKey 在接口中 BSONCallbackname - the name of the fieldpublic void gotMaxKey(java.lang.String name)
BSONCallbackBsonType.MAX_KEY value.gotMaxKey 在接口中 BSONCallbackname - the name of the fieldpublic void gotBoolean(java.lang.String name,
boolean value)
BSONCallbackBsonType.BOOLEAN value.gotBoolean 在接口中 BSONCallbackname - the name of the fieldvalue - the field's valuepublic void gotDouble(java.lang.String name,
double value)
BSONCallbackBsonType.DOUBLE value.gotDouble 在接口中 BSONCallbackname - the name of the fieldvalue - the field's valuepublic void gotInt(java.lang.String name,
int value)
BSONCallbackBsonType.INT32 value.gotInt 在接口中 BSONCallbackname - the name of the fieldvalue - the field's valuepublic void gotLong(java.lang.String name,
long value)
BSONCallbackBsonType.INT64 value.gotLong 在接口中 BSONCallbackname - the name of the fieldvalue - the field's valuepublic void gotDate(java.lang.String name,
long millis)
BSONCallbackBsonType.DATE_TIME value.gotDate 在接口中 BSONCallbackname - the name of the fieldmillis - the date and time in millisecondspublic void gotRegex(java.lang.String name,
java.lang.String pattern,
java.lang.String flags)
BSONCallbackBsonType.REGULAR_EXPRESSION value.gotRegex 在接口中 BSONCallbackname - the name of the fieldpattern - the regex patternflags - the optional flags for the regular expressionpublic void gotString(java.lang.String name,
java.lang.String value)
BSONCallbackBsonType.STRING value.gotString 在接口中 BSONCallbackname - the name of the fieldvalue - the field's valuepublic void gotSymbol(java.lang.String name,
java.lang.String value)
BSONCallbackBsonType.SYMBOL value.gotSymbol 在接口中 BSONCallbackname - the name of the fieldvalue - the field's valuepublic void gotTimestamp(java.lang.String name,
int time,
int increment)
BSONCallbackBsonType.TIMESTAMP value.gotTimestamp 在接口中 BSONCallbackname - the name of the fieldtime - the time in seconds since epochincrement - an incrementing ordinal for operations within a given secondpublic void gotObjectId(java.lang.String name,
ObjectId id)
BSONCallbackBsonType.OBJECT_ID value.gotObjectId 在接口中 BSONCallbackname - the name of the fieldid - the object IDpublic void gotDBRef(java.lang.String name,
java.lang.String namespace,
ObjectId id)
BSONCallbackBSONDecoder encountered a BsonType.DB_POINTER type field in a byte sequence.gotDBRef 在接口中 BSONCallbackname - the name of the fieldnamespace - the namespace to which reference is pointing toid - the if of the object to which reference is pointing to@Deprecated
public void gotBinaryArray(java.lang.String name,
byte[] data)
BSONCallbackgotBinaryArray 在接口中 BSONCallbackname - the name of the fielddata - the field's valuepublic void gotBinary(java.lang.String name,
byte type,
byte[] data)
BSONCallbackBsonType.BINARY value. Note that binary values have a subtype, which may
determine how the value is processed.gotBinary 在接口中 BSONCallbackname - the name of the fieldtype - one of the binary subtypes: BsonBinarySubTypedata - the field's valuepublic void gotUUID(java.lang.String name,
long part1,
long part2)
BSONCallbackUUID value. This is a binary value of subtype
BsonBinarySubType.UUID_LEGACYgotUUID 在接口中 BSONCallbackname - the name of the fieldpart1 - the first part of the UUIDpart2 - the second part of the UUIDpublic void gotCode(java.lang.String name,
java.lang.String code)
BSONCallbackBsonType.JAVASCRIPT value.gotCode 在接口中 BSONCallbackname - the name of the fieldcode - the JavaScript codepublic void gotCodeWScope(java.lang.String name,
java.lang.String code,
java.lang.Object scope)
BSONCallbackBsonType.JAVASCRIPT_WITH_SCOPE value.gotCodeWScope 在接口中 BSONCallbackname - the name of the fieldcode - the JavaScript codescope - a document representing the scope for the codeprotected void _put(java.lang.String name,
java.lang.Object value)
name - the name of the fieldvalue - the valueprotected BSONObject cur()
protected java.lang.String curName()
protected void setRoot(java.lang.Object root)
root - the new root documentprotected boolean isStackEmpty()
public void reset()
BSONCallbackreset 在接口中 BSONCallback