Package org.kuali.rice.core.util.jaxb
Class RiceXmlImportList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- org.kuali.rice.core.util.jaxb.RiceXmlImportList<E>
-
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,List<E>
public final class RiceXmlImportList<E> extends AbstractList<E> implements Serializable
Custom subclass of AbstractList that, when adding new items, will pass them on to a listener instead of storing them internally.This is based off of the JAXB "streaming" unmarshalling strategy, which is briefly mentioned here:
http://jaxb.java.net/guide/Dealing_with_large_documents.html
and is presented in the example code available here:
http://jaxb.java.net/2.2.4/
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description RiceXmlImportList(RiceXmlListAdditionListener<E> listAdditionListener)Constructs a new streaming list that will pass new items to the given listener instead of storing them.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)Instead of adding the item to the list, simply invoke the appropriate listener.Eget(int index)This method always throws an exception, since the list never contains any items.intsize()This method always returns zero, since items are never actually added to the list.-
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
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
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Constructor Detail
-
RiceXmlImportList
public RiceXmlImportList(RiceXmlListAdditionListener<E> listAdditionListener)
Constructs a new streaming list that will pass new items to the given listener instead of storing them.- Parameters:
listAdditionListener- The listener to use.- Throws:
IllegalArgumentException- if listAdditionListener is null.
-
-
Method Detail
-
add
public boolean add(E e)
Instead of adding the item to the list, simply invoke the appropriate listener.This is based off of the "streaming" unmarshalling strategy used in one of the JAXB sample apps.
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceList<E>- Overrides:
addin classAbstractList<E>- Returns:
- false, since the list never gets altered as a result of invoking this method.
-
get
public E get(int index)
This method always throws an exception, since the list never contains any items.- Specified by:
getin interfaceList<E>- Specified by:
getin classAbstractList<E>- Throws:
IndexOutOfBoundsException
-
size
public int size()
This method always returns zero, since items are never actually added to the list.- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>- Returns:
- zero.
-
-