public interface BSONObject extends Serializable
限定符和类型 | 方法和说明 |
---|---|
<T> T |
as(Class<T> cls)
Return an instance of the class "cls", only for BasicBSONObject.
|
<T> T |
as(Class<T> cls,
Type eleType)
Return an instance of the class "cls", only for BasicBSONObject.
|
boolean |
containsField(String s)
Checks if this object contains a field with the given name.
|
Object |
get(String key)
Gets a field from this object by a given name.
|
boolean |
isEmpty()
The current bson object keeps any elements or not
|
Set<String> |
keySet()
Returns this object's fields' names
|
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.
|
Map |
toMap()
Returns a map representing this BSONObject.
|
<T> T as(Class<T> cls) throws Exception
cls
- target class objectException
- If error happens.<T> T as(Class<T> cls, Type eleType) throws Exception
cls
- target class objectException
- If error happens.boolean containsField(String s)
s
- Field name for which to checkObject get(String key)
key
- The name of the field fetchboolean isEmpty()
Set<String> keySet()
Object put(String key, Object v)
key
- Name to setv
- Corresponding valuevoid putAll(BSONObject o)
o
- the objectvoid putAll(Map m)
m
- the mapObject removeField(String key)
key
- The name of the field to removeMap toMap()
Copyright © 2018. All rights reserved.