org.iternine.jeppetto.dao.mongodb.enhance
Class DirtyableDBObjectList

java.lang.Object
  extended by org.iternine.jeppetto.dao.mongodb.enhance.DirtyableDBObjectList
All Implemented Interfaces:
com.mongodb.DBObject, Iterable, Collection, List, org.bson.BSONObject, DirtyableDBObject
Direct Known Subclasses:
DirtyableDBObjectSet

public class DirtyableDBObjectList
extends Object
implements List, DirtyableDBObject


Constructor Summary
DirtyableDBObjectList()
          Default constructor that uses an ArrayList as the delegate and expects no non-Jeppetto access.
DirtyableDBObjectList(List delegate, boolean modifiableDelegate)
          Constructor that takes is passed the delegate list along w/ an indication as to whether the delegate is modifiable by code outside of Jeppetto.
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object element)
           
 boolean addAll(Collection elements)
           
 boolean addAll(int index, Collection elements)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection objects)
           
 boolean containsField(String s)
           
 boolean containsKey(String s)
           
 boolean equals(Object o)
           
 Object get(int index)
           
 Object get(String s)
           
 Object getDelegate()
           
 Iterator<String> getDirtyKeys()
           
 int hashCode()
           
 int indexOf(Object o)
           
 boolean isDirty()
           
 boolean isEmpty()
           
 boolean isPartialObject()
           
 boolean isPersisted(com.mongodb.DBCollection dbCollection)
           
 boolean isRewrite()
           
 Iterator iterator()
           
 Set<String> keySet()
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 void markAsPartialObject()
           
 void markPersisted(com.mongodb.DBCollection dbCollection)
          Consider the current state of the object to be in sync with the persisted state.
 Object put(String s, Object v)
           
 void putAll(org.bson.BSONObject o)
           
 void putAll(Map m)
           
 Object remove(int index)
           
 boolean remove(Object object)
           
 boolean removeAll(Collection collection)
           
 Object removeField(String s)
           
 boolean retainAll(Collection collection)
           
 Object set(int index, Object element)
           
 int size()
           
 List subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
 Object[] toArray(Object[] objects)
           
 Map toMap()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirtyableDBObjectList

public DirtyableDBObjectList()
Default constructor that uses an ArrayList as the delegate and expects no non-Jeppetto access.


DirtyableDBObjectList

public DirtyableDBObjectList(List delegate,
                             boolean modifiableDelegate)
Constructor that takes is passed the delegate list along w/ an indication as to whether the delegate is modifiable by code outside of Jeppetto.

Parameters:
delegate - the underlying List implementation
modifiableDelegate - true if access is possible to the delegate by non-Jeppetto code
Method Detail

add

public void add(int index,
                Object element)
Specified by:
add in interface List

addAll

public boolean addAll(int index,
                      Collection elements)
Specified by:
addAll in interface List

remove

public Object remove(int index)
Specified by:
remove in interface List

removeAll

public boolean removeAll(Collection collection)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List

set

public Object set(int index,
                  Object element)
Specified by:
set in interface List

add

public boolean add(Object element)
Specified by:
add in interface Collection
Specified by:
add in interface List

remove

public boolean remove(Object object)
Specified by:
remove in interface Collection
Specified by:
remove in interface List

addAll

public boolean addAll(Collection elements)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface List

retainAll

public boolean retainAll(Collection collection)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List

clear

public void clear()
Specified by:
clear in interface Collection
Specified by:
clear in interface List

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection
Specified by:
contains in interface List

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

toArray

public Object[] toArray(Object[] objects)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

containsAll

public boolean containsAll(Collection objects)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List

get

public Object get(int index)
Specified by:
get in interface List

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List

isDirty

public boolean isDirty()
Specified by:
isDirty in interface DirtyableDBObject
Returns:
true if this object is dirtied from it's persisted state

markPersisted

public void markPersisted(com.mongodb.DBCollection dbCollection)
Description copied from interface: DirtyableDBObject
Consider the current state of the object to be in sync with the persisted state.

Specified by:
markPersisted in interface DirtyableDBObject

isPersisted

public boolean isPersisted(com.mongodb.DBCollection dbCollection)
Specified by:
isPersisted in interface DirtyableDBObject
Returns:
true if this object has a representation in the underlying store.

getDirtyKeys

public Iterator<String> getDirtyKeys()
Specified by:
getDirtyKeys in interface DirtyableDBObject
Returns:
Set of keys corresponding to changed fields in this DBObject

getDelegate

public Object getDelegate()
Specified by:
getDelegate in interface DirtyableDBObject
Returns:
The object this DirtyableDBObject is delegating to, or null if it is managing everything itself

markAsPartialObject

public void markAsPartialObject()
Specified by:
markAsPartialObject in interface com.mongodb.DBObject

isPartialObject

public boolean isPartialObject()
Specified by:
isPartialObject in interface com.mongodb.DBObject

keySet

public Set<String> keySet()
Specified by:
keySet in interface org.bson.BSONObject

containsField

public boolean containsField(String s)
Specified by:
containsField in interface org.bson.BSONObject

containsKey

public boolean containsKey(String s)
Specified by:
containsKey in interface org.bson.BSONObject

removeField

public Object removeField(String s)
Specified by:
removeField in interface org.bson.BSONObject

toMap

public Map toMap()
Specified by:
toMap in interface org.bson.BSONObject

get

public Object get(String s)
Specified by:
get in interface org.bson.BSONObject

putAll

public void putAll(Map m)
Specified by:
putAll in interface org.bson.BSONObject

putAll

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

put

public Object put(String s,
                  Object v)
Specified by:
put in interface org.bson.BSONObject

isRewrite

public boolean isRewrite()

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection
Specified by:
equals in interface List
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection
Specified by:
hashCode in interface List
Overrides:
hashCode in class Object


Copyright © 2012. All Rights Reserved.