org.kuali.rice.core.util.jaxb
Class RiceXmlImportList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by 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
RiceXmlImportList(RiceXmlListAdditionListener<E> listAdditionListener)
          Constructs a new streaming list that will pass new items to the given listener instead of storing them.
 
Method Summary
 boolean add(E e)
          Instead of adding the item to the list, simply invoke the appropriate listener.
 E get(int index)
          This method always throws an exception, since the list never contains any items.
 int size()
          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.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, 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:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class AbstractList<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:
get in interface List<E>
Specified by:
get in class AbstractList<E>
Throws:
IndexOutOfBoundsException

size

public int size()
This method always returns zero, since items are never actually added to the list.

Specified by:
size in interface Collection<E>
Specified by:
size in interface List<E>
Specified by:
size in class AbstractCollection<E>
Returns:
zero.


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.