org.apache.openjpa.kernel
Class DelegatingResultList

java.lang.Object
  extended by org.apache.openjpa.kernel.DelegatingResultList
All Implemented Interfaces:
Serializable, Iterable, Collection, List, ResultList, Closeable

public class DelegatingResultList
extends Object
implements ResultList

Delegating result list that can also perform exception translation for use in facades.

Since:
0.4.0
Author:
Marc Prud'hommeaux
See Also:
Serialized Form

Nested Class Summary
 class DelegatingResultList.DelegatingListIterator
          Delegating iterator that also performs exception translation.
 
Constructor Summary
DelegatingResultList(ResultList list)
          Constructor; supply delegate.
DelegatingResultList(ResultList list, RuntimeExceptionTranslator trans)
          Constructor; supply delegate and exception translator.
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 boolean addAll(int index, Collection c)
           
 void clear()
           
 void close()
          Close the list.
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 boolean equals(Object other)
           
 Object get(int index)
           
 ResultList getDelegate()
          Return the direct delegate.
 ResultList getInnermostDelegate()
          Return the native delegate.
 int hashCode()
           
 int indexOf(Object o)
           
 boolean isClosed()
          Returns true if the list has been closed.
 boolean isEmpty()
           
 boolean isProviderOpen()
          Returns true if the provider backing this list is open.
 Iterator iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 boolean retainAll(Collection c)
           
 Object set(int index, Object element)
           
 int size()
           
 List subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
protected  RuntimeException translate(RuntimeException re)
          Translate the OpenJPA exception.
 Object writeReplace()
          Writes delegate, which may in turn write a normal list.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingResultList

public DelegatingResultList(ResultList list)
Constructor; supply delegate.


DelegatingResultList

public DelegatingResultList(ResultList list,
                            RuntimeExceptionTranslator trans)
Constructor; supply delegate and exception translator.

Method Detail

getDelegate

public ResultList getDelegate()
Return the direct delegate.


getInnermostDelegate

public ResultList getInnermostDelegate()
Return the native delegate.


writeReplace

public Object writeReplace()
                    throws ObjectStreamException
Writes delegate, which may in turn write a normal list.

Throws:
ObjectStreamException

hashCode

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

equals

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

translate

protected RuntimeException translate(RuntimeException re)
Translate the OpenJPA exception.


isProviderOpen

public boolean isProviderOpen()
Description copied from interface: ResultList
Returns true if the provider backing this list is open.

Specified by:
isProviderOpen in interface ResultList

close

public void close()
Description copied from interface: ResultList
Close the list.

Specified by:
close in interface ResultList
Specified by:
close in interface Closeable

isClosed

public boolean isClosed()
Description copied from interface: ResultList
Returns true if the list has been closed.

Specified by:
isClosed in interface ResultList

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[] a)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

add

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

remove

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

containsAll

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

addAll

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

addAll

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

removeAll

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

retainAll

public boolean retainAll(Collection c)
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

get

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

set

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

add

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

remove

public Object remove(int index)
Specified by:
remove 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


Copyright © 2006 Apache Software Foundation. All Rights Reserved.