Package org.apache.openjpa.kernel
Class DelegatingResultList<T>
- java.lang.Object
-
- org.apache.openjpa.kernel.DelegatingResultList<T>
-
- All Implemented Interfaces:
Serializable,Iterable<T>,Collection<T>,List<T>,ResultList<T>,Closeable
public class DelegatingResultList<T> extends Object implements ResultList<T>
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
Nested Classes Modifier and Type Class Description classDelegatingResultList.DelegatingListIterator<T>Delegating iterator that also performs exception translation.
-
Constructor Summary
Constructors Constructor Description DelegatingResultList(ResultList<T> list)Constructor; supply delegate.DelegatingResultList(ResultList<T> list, RuntimeExceptionTranslator trans)Constructor; supply delegate and exception translator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, T element)booleanadd(T o)booleanaddAll(int index, Collection<? extends T> c)booleanaddAll(Collection<? extends T> c)voidclear()voidclose()Close the list.booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanequals(Object other)Tget(int index)ResultList<T>getDelegate()Return the direct delegate.ResultList<T>getInnermostDelegate()Return the native delegate.ObjectgetUserObject()Get the opaque user object attached to this receiver.inthashCode()intindexOf(Object o)booleanisClosed()Returns true if the list has been closed.booleanisEmpty()booleanisProviderOpen()Returns true if the provider backing this list is open.Iterator<T>iterator()intlastIndexOf(Object o)ListIterator<T>listIterator()ListIterator<T>listIterator(int index)Tremove(int index)booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)Tset(int index, T element)voidsetUserObject(Object opaque)Set the opaque user object to this receiver.intsize()List<T>subList(int fromIndex, int toIndex)Object[]toArray()Object[]toArray(Object[] a)StringtoString()protected RuntimeExceptiontranslate(RuntimeException re)Translate the OpenJPA exception.ObjectwriteReplace()Writes delegate, which may in turn write a normal list.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Constructor Detail
-
DelegatingResultList
public DelegatingResultList(ResultList<T> list)
Constructor; supply delegate.
-
DelegatingResultList
public DelegatingResultList(ResultList<T> list, RuntimeExceptionTranslator trans)
Constructor; supply delegate and exception translator.
-
-
Method Detail
-
getDelegate
public ResultList<T> getDelegate()
Return the direct delegate.
-
getInnermostDelegate
public ResultList<T> 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()
-
equals
public boolean equals(Object other)
-
translate
protected RuntimeException translate(RuntimeException re)
Translate the OpenJPA exception.
-
isProviderOpen
public boolean isProviderOpen()
Description copied from interface:ResultListReturns true if the provider backing this list is open.- Specified by:
isProviderOpenin interfaceResultList<T>
-
getUserObject
public Object getUserObject()
Description copied from interface:ResultListGet the opaque user object attached to this receiver.- Specified by:
getUserObjectin interfaceResultList<T>
-
setUserObject
public void setUserObject(Object opaque)
Description copied from interface:ResultListSet the opaque user object to this receiver.- Specified by:
setUserObjectin interfaceResultList<T>
-
close
public void close()
Description copied from interface:ResultListClose the list.- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceResultList<T>
-
isClosed
public boolean isClosed()
Description copied from interface:ResultListReturns true if the list has been closed.- Specified by:
isClosedin interfaceResultList<T>
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(Object o)
-
toArray
public Object[] toArray()
-
add
public boolean add(T o)
-
remove
public boolean remove(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceList<T>
-
addAll
public boolean addAll(Collection<? extends T> c)
-
addAll
public boolean addAll(int index, Collection<? extends T> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
clear
public void clear()
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOfin interfaceList<T>
-
listIterator
public ListIterator<T> listIterator()
- Specified by:
listIteratorin interfaceList<T>
-
listIterator
public ListIterator<T> listIterator(int index)
- Specified by:
listIteratorin interfaceList<T>
-
-