public class LazyBSONObject extends Object implements BSONObject
Modifier and Type | Class and Description |
---|---|
class |
LazyBSONObject.LazyBSONKeySet
Deprecated.
This class is NOT a part of public API and will be dropped in 3.x versions.
|
Modifier and Type | Field and Description |
---|---|
protected LazyBSONCallback |
_callback
Deprecated.
This field is NOT a part of public API and will be dropped in 3.x versions.
|
protected int |
_doc_start_offset
Deprecated.
Please use
getOffset() instead. |
protected BSONByteBuffer |
_input
Deprecated.
Please use
getBytes() to access underlying bytes. |
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(String s)
Checks if this object contains a field with the given name.
|
boolean |
containsKey(String s)
Deprecated.
|
Set<Map.Entry<String,Object>> |
entrySet()
This method will be more efficient than using a combination of keySet() and get(String key)
|
boolean |
equals(Object o) |
Object |
get(String key)
Gets a field from this object by a given name.
|
int |
getBSONSize() |
protected byte[] |
getBytes() |
protected int |
getElementBSONSize(int offset)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
protected byte |
getElementType(int offset)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
protected Object |
getElementValue(org.bson.LazyBSONObject.ElementRecord record)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
protected int |
getOffset() |
int |
hashCode() |
protected boolean |
isElementEmpty(int offset)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
boolean |
isEmpty() |
Set<String> |
keySet()
Returns this object's fields' names
|
int |
pipe(OutputStream os) |
Object |
put(String key,
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(Map m)
Sets all key/value pairs from a map into this object
|
Object |
removeField(String key)
Removes a field with a given name from this object.
|
protected int |
sizeCString(int offset)
Deprecated.
This method is NOT a part of public API and will be dropped in 3.x versions.
|
Map |
toMap()
Returns a map representing this BSONObject.
|
String |
toString()
Returns a JSON serialization of this object
|
@Deprecated protected final int _doc_start_offset
getOffset()
instead.@Deprecated protected final BSONByteBuffer _input
getBytes()
to access underlying bytes.@Deprecated 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 Object put(String key, 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(Map m)
BSONObject
putAll
in interface BSONObject
m
- the mappublic Object get(String key)
BSONObject
get
in interface BSONObject
key
- The name of the field fetchpublic Map toMap()
BSONObject
toMap
in interface BSONObject
public Object removeField(String key)
BSONObject
removeField
in interface BSONObject
key
- The name of the field to remove@Deprecated public boolean containsKey(String s)
BSONObject
containsKey
in interface BSONObject
public boolean containsField(String s)
BSONObject
containsField
in interface BSONObject
s
- Field name for which to checkpublic Set<String> keySet()
BSONObject
keySet
in interface BSONObject
public Set<Map.Entry<String,Object>> entrySet()
@Deprecated protected boolean isElementEmpty(int offset)
public boolean isEmpty()
public int getBSONSize()
public int pipe(OutputStream os) throws IOException
IOException
@Deprecated protected byte getElementType(int offset)
@Deprecated protected int getElementBSONSize(int offset)
@Deprecated protected int sizeCString(int offset)
offset
- the offset into the buffer@Deprecated protected Object getElementValue(org.bson.LazyBSONObject.ElementRecord record)
protected int getOffset()
protected byte[] getBytes()