public class LazyBSONObject extends java.lang.Object implements BSONObject
Modifier and Type | Class and Description |
---|---|
class |
LazyBSONObject.LazyBSONKeySet |
Modifier and Type | Field and Description |
---|---|
protected LazyBSONCallback |
_callback |
protected int |
_doc_start_offset |
protected BSONByteBuffer |
_input |
Constructor and Description |
---|
LazyBSONObject(BSONByteBuffer buffer,
int offset,
LazyBSONCallback callback) |
LazyBSONObject(BSONByteBuffer buffer,
LazyBSONCallback callback) |
LazyBSONObject(byte[] data,
int offset,
LazyBSONCallback callback) |
LazyBSONObject(byte[] data,
LazyBSONCallback callback) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsField(java.lang.String s)
Checks if this object contains a field with the given name.
|
boolean |
containsKey(java.lang.String s)
Deprecated.
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet()
This method will be more efficient than using a combination of keySet() and get(String key)
|
boolean |
equals(java.lang.Object o) |
java.lang.Object |
get(java.lang.String key)
Gets a field from this object by a given name.
|
int |
getBSONSize() |
protected int |
getElementBSONSize(int offset) |
protected byte |
getElementType(int offset) |
protected java.lang.Object |
getElementValue(org.bson.LazyBSONObject.ElementRecord record) |
int |
hashCode() |
protected boolean |
isElementEmpty(int offset) |
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet()
Returns this object's fields' names
|
int |
pipe(java.io.OutputStream os) |
java.lang.Object |
put(java.lang.String key,
java.lang.Object v)
Sets a name/value pair in this object.
|
void |
putAll(BSONObject o)
Sets all key/value pairs from an object into this object
|
void |
putAll(java.util.Map m)
Sets all key/value pairs from a map into this object
|
java.lang.Object |
removeField(java.lang.String key)
Removes a field with a given name from this object.
|
protected int |
sizeCString(int offset)
Returns the size of the BSON cstring at the given offset in the buffer
|
java.util.Map |
toMap()
Returns a map representing this BSONObject.
|
java.lang.String |
toString()
Returns a JSON serialization of this object
|
protected final int _doc_start_offset
protected final BSONByteBuffer _input
protected final LazyBSONCallback _callback
public LazyBSONObject(byte[] data, LazyBSONCallback callback)
public LazyBSONObject(byte[] data, int offset, LazyBSONCallback callback)
public LazyBSONObject(BSONByteBuffer buffer, LazyBSONCallback callback)
public LazyBSONObject(BSONByteBuffer buffer, int offset, LazyBSONCallback callback)
public java.lang.Object put(java.lang.String key, java.lang.Object v)
BSONObject
put
in interface BSONObject
key
- Name to setv
- Corresponding valuepublic void putAll(BSONObject o)
BSONObject
putAll
in interface BSONObject
o
- the objectpublic void putAll(java.util.Map m)
BSONObject
putAll
in interface BSONObject
m
- the mappublic java.lang.Object get(java.lang.String key)
BSONObject
get
in interface BSONObject
key
- The name of the field fetchpublic java.util.Map toMap()
BSONObject
toMap
in interface BSONObject
public java.lang.Object removeField(java.lang.String key)
BSONObject
removeField
in interface BSONObject
key
- The name of the field to remove@Deprecated public boolean containsKey(java.lang.String s)
BSONObject
containsKey
in interface BSONObject
public boolean containsField(java.lang.String s)
BSONObject
containsField
in interface BSONObject
s
- Field name for which to checkpublic java.util.Set<java.lang.String> keySet()
BSONObject
keySet
in interface BSONObject
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
protected boolean isElementEmpty(int offset)
public boolean isEmpty()
public int getBSONSize()
public int pipe(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
protected byte getElementType(int offset)
protected int getElementBSONSize(int offset)
protected int sizeCString(int offset)
offset
- the offset into the bufferprotected java.lang.Object getElementValue(org.bson.LazyBSONObject.ElementRecord record)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object