org.apache.ojb.broker.util.collections
Class RemovalAwareCollection

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended byorg.apache.ojb.broker.util.collections.ManageableVector
                  extended byorg.apache.ojb.broker.util.collections.RemovalAwareCollection
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, ManageableCollection, java.util.RandomAccess, java.io.Serializable

public class RemovalAwareCollection
extends ManageableVector

This is a collection that tracks removal and addition of elements. This tracking allow the PersistenceBroker to delete elements from the database that have been removed from the collection before a PB.store() orperation occurs. This will allow to use the PB api in way pretty close to ODMG persistent collections!

Author:
Thomas Mahler
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface org.apache.ojb.broker.ManageableCollection
serialVersionUID
 
Constructor Summary
RemovalAwareCollection()
           
 
Method Summary
 void afterStore(PersistenceBroker broker)
          A callback method to implement 'removal-aware' (track removed objects and delete them by its own) collection implementations.
protected  void registerForDeletion(java.lang.Object toBeRemoved)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 void removeAllElements()
           
 void removeElementAt(int index)
           
protected  void removeRange(int fromIndex, int toIndex)
           
 
Methods inherited from class org.apache.ojb.broker.util.collections.ManageableVector
ojbAdd, ojbAddAll, ojbIterator
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, removeAll, removeElement, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

RemovalAwareCollection

public RemovalAwareCollection()
Method Detail

afterStore

public void afterStore(PersistenceBroker broker)
                throws PersistenceBrokerException
Description copied from interface: ManageableCollection
A callback method to implement 'removal-aware' (track removed objects and delete them by its own) collection implementations.

Specified by:
afterStore in interface ManageableCollection
Overrides:
afterStore in class ManageableVector
Throws:
PersistenceBrokerException
See Also:
ManageableCollection.afterStore(PersistenceBroker broker)

remove

public java.lang.Object remove(int index)
See Also:
List.remove(int)

registerForDeletion

protected void registerForDeletion(java.lang.Object toBeRemoved)

remove

public boolean remove(java.lang.Object o)
See Also:
Collection.remove(Object)

removeAllElements

public void removeAllElements()
See Also:
Vector.removeAllElements()

removeElementAt

public void removeElementAt(int index)
See Also:
Vector.removeElementAt(int)

removeRange

protected void removeRange(int fromIndex,
                           int toIndex)
See Also:
AbstractList.removeRange(int, int)


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14