|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mongodb.ReflectionDBObject
public abstract class ReflectionDBObject
This class enables to map simple Class fields to a BSON object fields
Nested Class Summary | |
---|---|
static class |
ReflectionDBObject.JavaWrapper
Represents a wrapper around the DBObject to interface with the Class fields |
Constructor Summary | |
---|---|
ReflectionDBObject()
|
Method Summary | |
---|---|
boolean |
containsField(String s)
Checks if this object contains a field with the given name. |
boolean |
containsKey(String s)
Deprecated. |
Object |
get_id()
Gets the _id |
Object |
get(String key)
Gets a field from this object by a given name. |
static ReflectionDBObject.JavaWrapper |
getWrapper(Class c)
Returns an existing Wrapper instance associated with a class, or creates a new one. |
static ReflectionDBObject.JavaWrapper |
getWrapperIfReflectionObject(Class c)
Returns the wrapper if this object can be assigned from this class |
boolean |
isPartialObject()
whether markAsPartialObject was ever called only matters if you are going to upsert and do not want to risk losing fields |
Set<String> |
keySet()
Returns this object's fields' names |
void |
markAsPartialObject()
ReflectionDBObjects can't be partial |
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)
can't remove from a ReflectionDBObject |
void |
set_id(Object id)
Sets the _id |
Map |
toMap()
Returns a map representing this BSONObject. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReflectionDBObject()
Method Detail |
---|
public Object get(String key)
BSONObject
get
in interface BSONObject
key
- The name of the field fetch
public Set<String> keySet()
BSONObject
keySet
in interface BSONObject
@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 check
public Object put(String key, Object v)
BSONObject
put
in interface BSONObject
key
- Name to setv
- Corresponding value
public void putAll(Map m)
BSONObject
putAll
in interface BSONObject
m
- the mappublic void putAll(BSONObject o)
BSONObject
putAll
in interface BSONObject
o
- the objectpublic Object get_id()
public void set_id(Object id)
id
- public boolean isPartialObject()
DBObject
isPartialObject
in interface DBObject
public Map toMap()
BSONObject
toMap
in interface BSONObject
public void markAsPartialObject()
markAsPartialObject
in interface DBObject
public Object removeField(String key)
removeField
in interface BSONObject
key
-
public static ReflectionDBObject.JavaWrapper getWrapperIfReflectionObject(Class c)
c
-
public static ReflectionDBObject.JavaWrapper getWrapper(Class c)
c
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |