org.apache.openjpa.util
Class DelayedArrayListProxy

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

public class DelayedArrayListProxy
extends ArrayList
implements ProxyCollection, DelayedProxy

ArrayList proxy with delay loading capability. Allows non-indexed add and remove operations to occur on an unloaded collection. Operations that require a load will trigger a load.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DelayedArrayListProxy()
           
DelayedArrayListProxy(Collection paramCollection)
           
DelayedArrayListProxy(int paramInt)
           
 
Method Summary
 void add(int paramInt, Object paramObject)
           
 boolean add(Object paramObject)
           
 boolean addAll(Collection paramCollection)
           
 boolean addAll(int paramInt, Collection paramCollection)
           
 void clear()
           
 Object clone()
           
 void closeBroker()
          Close the broker that is used to service this proxy.
 boolean contains(Object object)
           
 boolean containsAll(Collection collection)
           
 Object copy(Object paramObject)
          Return an unproxied copy of the given instance.
 boolean equals(Object paramObject)
           
 Object get(int location)
           
 Broker getBroker()
          Get the broker that is used to service this proxy.
 BrokerFactory getBrokerFactory()
           
 ChangeTracker getChangeTracker()
          Return the change tracker for this proxy, or null if none.
 int getDelayedField()
          Returns the expected field index even if this collection was detached.
 OpenJPAStateManager getDelayedOwner()
          Returns a state manager that can service this proxy even if the collection was detached.
 Class getElementType()
          The collection element type.
 OpenJPAStateManager getOwner()
          Return the owning object.
 int getOwnerField()
          Return the owning field index.
 OpenJPAStateManager getOwnerStateManager()
          Returns the state manager of the owning instance.
 int hashCode()
           
 int indexOf(Object object)
           
 boolean isDelayLoad()
           
 boolean isDetached()
          Returns whether the proxy is detached.
 boolean isDirectAccess()
          Returns whether the caller has direct-call access to the proxied object.
 boolean isEmpty()
           
 Iterator iterator()
           
 int lastIndexOf(Object object)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int paramInt)
           
 void load()
          Load the proxy if it was delay-loaded.
 ProxyCollection newInstance(Class paramClass, Comparator paramComparator, boolean paramBoolean1, boolean paramBoolean2)
          Create a new instance of this proxy type.
 Object remove(int paramInt)
           
 boolean remove(Object paramObject)
           
 boolean removeAll(Collection paramCollection)
           
 boolean retainAll(Collection paramCollection)
           
 Object set(int paramInt, Object paramObject)
           
protected  void setChangeTracker(CollectionChangeTracker ct)
           
 void setDirectAccess(boolean direct)
          Sets whether the caller has direct-call access to the proxied object.
protected  void setElementType(Class<?> elemType)
           
 void setOwner(OpenJPAStateManager paramOpenJPAStateManager, int paramInt)
          Reset the state of the proxy, and set the owning instance of the proxy and the name of the field it is assigned to.
 int size()
           
 List subList(int start, int end)
           
 Object[] toArray()
           
 Object[] toArray(Object[] array)
           
protected  Object writeReplace()
           
 
Methods inherited from class java.util.ArrayList
ensureCapacity, removeRange, trimToSize
 
Methods inherited from class java.util.AbstractCollection
toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DelayedArrayListProxy

public DelayedArrayListProxy()

DelayedArrayListProxy

public DelayedArrayListProxy(Collection paramCollection)

DelayedArrayListProxy

public DelayedArrayListProxy(int paramInt)
Method Detail

setOwner

public void setOwner(OpenJPAStateManager paramOpenJPAStateManager,
                     int paramInt)
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

getDelayedField

public int getDelayedField()
Description copied from interface: DelayedProxy
Returns the expected field index even if this collection was detached.

Specified by:
getDelayedField in interface DelayedProxy
Returns:

getDelayedOwner

public OpenJPAStateManager getDelayedOwner()
Description copied from interface: DelayedProxy
Returns a state manager that can service this proxy even if the collection was detached.

Specified by:
getDelayedOwner in interface DelayedProxy

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

clone

public Object clone()
Overrides:
clone in class ArrayList

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

setChangeTracker

protected void setChangeTracker(CollectionChangeTracker ct)

copy

public Object copy(Object paramObject)
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

getElementType

public Class getElementType()
Description copied from interface: ProxyCollection
The collection element type.

Specified by:
getElementType in interface ProxyCollection

setElementType

protected void setElementType(Class<?> elemType)

newInstance

public ProxyCollection newInstance(Class paramClass,
                                   Comparator paramComparator,
                                   boolean paramBoolean1,
                                   boolean paramBoolean2)
Description copied from interface: ProxyCollection
Create a new instance of this proxy type.

Specified by:
newInstance in interface ProxyCollection

add

public boolean add(Object paramObject)
Specified by:
add in interface Collection
Specified by:
add in interface List
Overrides:
add in class ArrayList

add

public void add(int paramInt,
                Object paramObject)
Specified by:
add in interface List
Overrides:
add in class ArrayList

clear

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

addAll

public boolean addAll(int paramInt,
                      Collection paramCollection)
Specified by:
addAll in interface List
Overrides:
addAll in class ArrayList

addAll

public boolean addAll(Collection paramCollection)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Overrides:
addAll in class ArrayList

remove

public boolean remove(Object paramObject)
Specified by:
remove in interface Collection
Specified by:
remove in interface List
Overrides:
remove in class ArrayList

remove

public Object remove(int paramInt)
Specified by:
remove in interface List
Overrides:
remove in class ArrayList

set

public Object set(int paramInt,
                  Object paramObject)
Specified by:
set in interface List
Overrides:
set in class ArrayList

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(int paramInt)
Specified by:
listIterator in interface List
Overrides:
listIterator in class AbstractList

listIterator

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

removeAll

public boolean removeAll(Collection paramCollection)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List
Overrides:
removeAll in class AbstractCollection

retainAll

public boolean retainAll(Collection paramCollection)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List
Overrides:
retainAll in class AbstractCollection

writeReplace

protected Object writeReplace()
                       throws ObjectStreamException
Throws:
ObjectStreamException

isDelayLoad

public boolean isDelayLoad()

get

public Object get(int location)
Specified by:
get in interface List
Overrides:
get in class ArrayList

indexOf

public int indexOf(Object object)
Specified by:
indexOf in interface List
Overrides:
indexOf in class ArrayList

lastIndexOf

public int lastIndexOf(Object object)
Specified by:
lastIndexOf in interface List
Overrides:
lastIndexOf in class ArrayList

subList

public List subList(int start,
                    int end)
Specified by:
subList in interface List
Overrides:
subList in class AbstractList

contains

public boolean contains(Object object)
Specified by:
contains in interface Collection
Specified by:
contains in interface List
Overrides:
contains in class ArrayList

containsAll

public boolean containsAll(Collection collection)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List
Overrides:
containsAll in class AbstractCollection

isEmpty

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

size

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

toArray

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

toArray

public Object[] toArray(Object[] array)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Overrides:
toArray in class ArrayList

equals

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

hashCode

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

isDirectAccess

public boolean isDirectAccess()
Description copied from interface: DelayedProxy
Returns whether the caller has direct-call access to the proxied object. Direct access allows calls to be made on the object without triggering a load or proxy state tracking callbacks.

Specified by:
isDirectAccess in interface DelayedProxy

setDirectAccess

public void setDirectAccess(boolean direct)
Description copied from interface: DelayedProxy
Sets whether the caller has direct-call access to the proxied object. Direct access allows calls to be made on the object without triggering a load or proxy state tracking callbacks.

Specified by:
setDirectAccess in interface DelayedProxy

getBrokerFactory

public BrokerFactory getBrokerFactory()

load

public void load()
Description copied from interface: DelayedProxy
Load the proxy if it was delay-loaded.

Specified by:
load in interface DelayedProxy

getBroker

public Broker getBroker()
Description copied from interface: DelayedProxy
Get the broker that is used to service this proxy.

Specified by:
getBroker in interface DelayedProxy

closeBroker

public void closeBroker()
Description copied from interface: DelayedProxy
Close the broker that is used to service this proxy.

Specified by:
closeBroker in interface DelayedProxy

getOwnerStateManager

public OpenJPAStateManager getOwnerStateManager()
Description copied from interface: DelayedProxy
Returns the state manager of the owning instance.

Specified by:
getOwnerStateManager in interface DelayedProxy

isDetached

public boolean isDetached()
Description copied from interface: DelayedProxy
Returns whether the proxy is detached.

Specified by:
isDetached in interface DelayedProxy
Returns:


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.