Class 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
    • 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.
      • 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.