org.apache.openjpa.util
Class ProxyVector

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector
              extended by org.apache.openjpa.util.ProxyVector
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess, Proxy, ProxyCollection

public class ProxyVector
extends Vector
implements ProxyCollection

Extension of the Vector type that dirties the persistent/transactional field it is assigned to on modification. The need to dirty the field on any modification mandates that this class must override all mutator methods of the base type. This may lead to multiple calls to dirty for one state change if one mutator method of the base type calls another.

Author:
Abe White
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ProxyVector()
           
ProxyVector(Class elementType, boolean trackChanges, OpenJPAConfiguration conf)
           
 
Method Summary
 void add(int index, Object value)
           
 boolean add(Object value)
           
 boolean addAll(Collection values)
           
 boolean addAll(int index, Collection values)
           
 void addElement(Object value)
           
 void clear()
           
 Object copy(Object orig)
          Return an unproxied copy of the given instance.
 ChangeTracker getChangeTracker()
          Return the change tracker for this proxy, or null if none.
 OpenJPAStateManager getOwner()
          Return the owning object.
 int getOwnerField()
          Return the owning field index.
 void insertElementAt(Object value, int index)
           
 Iterator iterator()
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 ProxyCollection newInstance(Class elementType, Comparator compare, boolean trackChanges, OpenJPAConfiguration conf)
          This method should return a new proxy of the same concrete type as the implementing class.
 Object remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 void removeAllElements()
           
 boolean removeElement(Object o)
           
 void removeElementAt(int index)
           
 boolean retainAll(Collection c)
           
 Object set(int index, Object value)
           
 void setElementAt(Object value, int index)
           
 void setOwner(OpenJPAStateManager sm, int field)
          Reset the state of the proxy, and set the owning instance of the proxy and the name of the field it is assigned to.
protected  Object writeReplace()
           
 
Methods inherited from class java.util.Vector
capacity, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, removeRange, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProxyVector

public ProxyVector()

ProxyVector

public ProxyVector(Class elementType,
                   boolean trackChanges,
                   OpenJPAConfiguration conf)
Method Detail

setOwner

public void setOwner(OpenJPAStateManager sm,
                     int field)
Description copied from interface: Proxy
Reset the state of the proxy, and set the owning instance of the proxy and the name of the field it is assigned to. Set to null to indicate that the proxy is no longer managed.

Specified by:
setOwner in interface Proxy

getOwner

public OpenJPAStateManager getOwner()
Description copied from interface: Proxy
Return the owning object.

Specified by:
getOwner in interface Proxy

getOwnerField

public int getOwnerField()
Description copied from interface: Proxy
Return the owning field index.

Specified by:
getOwnerField in interface Proxy

getChangeTracker

public ChangeTracker getChangeTracker()
Description copied from interface: Proxy
Return the change tracker for this proxy, or null if none.

Specified by:
getChangeTracker in interface Proxy

copy

public Object copy(Object orig)
Description copied from interface: Proxy
Return an unproxied copy of the given instance. This method is used by proxy managers to create backup values for use in rollback.

Specified by:
copy in interface Proxy

newInstance

public ProxyCollection newInstance(Class elementType,
                                   Comparator compare,
                                   boolean trackChanges,
                                   OpenJPAConfiguration conf)
Description copied from interface: ProxyCollection
This method should return a new proxy of the same concrete type as the implementing class. Used by the ProxyManager factories: one template instance of each type is created for the purpose of producing new instances via this method. Overcomes the performance penalties of reflection.

Specified by:
newInstance in interface ProxyCollection

add

public void add(int index,
                Object value)
Specified by:
add in interface List
Overrides:
add in class Vector

insertElementAt

public void insertElementAt(Object value,
                            int index)
Overrides:
insertElementAt in class Vector

add

public boolean add(Object value)
Specified by:
add in interface Collection
Specified by:
add in interface List
Overrides:
add in class Vector

addElement

public void addElement(Object value)
Overrides:
addElement in class Vector

addAll

public boolean addAll(int index,
                      Collection values)
Specified by:
addAll in interface List
Overrides:
addAll in class Vector

addAll

public boolean addAll(Collection values)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Overrides:
addAll in class Vector

clear

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

removeAllElements

public void removeAllElements()
Overrides:
removeAllElements in class Vector

iterator

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

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List
Overrides:
listIterator in class AbstractList

listIterator

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

remove

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

removeElementAt

public void removeElementAt(int index)
Overrides:
removeElementAt in class Vector

remove

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

removeElement

public boolean removeElement(Object o)
Overrides:
removeElement in class Vector

removeAll

public boolean removeAll(Collection c)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List
Overrides:
removeAll in class Vector

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List
Overrides:
retainAll in class Vector

set

public Object set(int index,
                  Object value)
Specified by:
set in interface List
Overrides:
set in class Vector

setElementAt

public void setElementAt(Object value,
                         int index)
Overrides:
setElementAt in class Vector

writeReplace

protected Object writeReplace()
                       throws ObjectStreamException
Throws:
ObjectStreamException


Copyright © 2006 Apache Software Foundation. All Rights Reserved.