com.mongodb
Class ReflectionDBObject

java.lang.Object
  extended by com.mongodb.ReflectionDBObject
All Implemented Interfaces:
DBObject, BSONObject

public abstract class ReflectionDBObject
extends java.lang.Object
implements DBObject


Nested Class Summary
static class ReflectionDBObject.JavaWrapper
           
 
Constructor Summary
ReflectionDBObject()
           
 
Method Summary
 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.lang.Object get_id()
           
 java.lang.Object get(java.lang.String key)
          Gets a field from this object by a given name.
static ReflectionDBObject.JavaWrapper getWrapper(java.lang.Class c)
           
static ReflectionDBObject.JavaWrapper getWrapperIfReflectionObject(java.lang.Class c)
           
 boolean isPartialObject()
          whether markAsPartialObject was ever called only matters if you are going to upsert and dont' want to risk losing fields
 java.util.Set<java.lang.String> keySet()
          Returns this object's fields' names
 void markAsPartialObject()
          if this object was loaded with only some fields (using a field filter) this method will be called to notify
 java.lang.Object put(java.lang.String key, java.lang.Object v)
          Sets a name/value pair in this object.
 void putAll(BSONObject o)
           
 void putAll(java.util.Map m)
           
 java.lang.Object removeField(java.lang.String key)
          Remove a field with a given name from this object.
 void set_id(java.lang.Object id)
           
 java.util.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

ReflectionDBObject

public ReflectionDBObject()
Method Detail

get

public java.lang.Object get(java.lang.String key)
Description copied from interface: BSONObject
Gets a field from this object by a given name.

Specified by:
get in interface BSONObject
Parameters:
key - The name of the field fetch
Returns:
The field, if found

keySet

public java.util.Set<java.lang.String> keySet()
Description copied from interface: BSONObject
Returns this object's fields' names

Specified by:
keySet in interface BSONObject
Returns:
The names of the fields in this object

containsKey

public boolean containsKey(java.lang.String s)
Deprecated. 

Specified by:
containsKey in interface BSONObject

containsField

public boolean containsField(java.lang.String s)
Description copied from interface: BSONObject
Checks if this object contains a field with the given name.

Specified by:
containsField in interface BSONObject
Parameters:
s - Field name for which to check
Returns:
if this object contains a field with the given name

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object v)
Description copied from interface: BSONObject
Sets a name/value pair in this object.

Specified by:
put in interface BSONObject
Parameters:
key - Name to set
v - Corresponding value
Returns:
v

putAll

public void putAll(java.util.Map m)
Specified by:
putAll in interface BSONObject

putAll

public void putAll(BSONObject o)
Specified by:
putAll in interface BSONObject

get_id

public java.lang.Object get_id()

set_id

public void set_id(java.lang.Object id)

isPartialObject

public boolean isPartialObject()
Description copied from interface: DBObject
whether markAsPartialObject was ever called only matters if you are going to upsert and dont' want to risk losing fields

Specified by:
isPartialObject in interface DBObject

toMap

public java.util.Map toMap()
Description copied from interface: BSONObject
Returns a map representing this BSONObject.

Specified by:
toMap in interface BSONObject
Returns:
the map

markAsPartialObject

public void markAsPartialObject()
Description copied from interface: DBObject
if this object was loaded with only some fields (using a field filter) this method will be called to notify

Specified by:
markAsPartialObject in interface DBObject

removeField

public java.lang.Object removeField(java.lang.String key)
Description copied from interface: BSONObject
Remove a field with a given name from this object.

Specified by:
removeField in interface BSONObject
Parameters:
key - The name of the field to remove
Returns:
The value removed from this object

getWrapperIfReflectionObject

public static ReflectionDBObject.JavaWrapper getWrapperIfReflectionObject(java.lang.Class c)

getWrapper

public static ReflectionDBObject.JavaWrapper getWrapper(java.lang.Class c)