001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.core.util.jaxb;
017
018import java.io.Serializable;
019
020/**
021 * Helper interface for use with the RiceXmlExportList class.
022 * 
023 * <p>If semi-"streaming" of child elements is desired during JAXB marshalling, then the parent element
024 * assigns an instance of RiceXmlExportList to the appropriate list field/property, and gives the
025 * list an implementation of this interface for the list to invoke whenever it needs to create a new
026 * instance of the next child element. This allows the implementation to create and then discard
027 * child elements during marshalling.
028 * 
029 * @param E The type that the list is expected to return.
030 * @param T The type that the list stores internally and passes to the listener for conversion as needed.
031 * 
032 * @author Kuali Rice Team (rice.collab@kuali.org)
033 */
034public interface RiceXmlListGetterListener<E,T> extends Serializable {
035        /**
036         * A listener method that converts the given item into the one expected by the list. It is invoked
037         * whenever the associated list's "get" method is called.
038         * 
039         * @param nextItem The item to convert.
040         * @param index The index being accessed on the RiceXmlExportList instance.
041         * @return The converted element that the list is expected to return.
042         */
043        public E gettingNextItem(T nextItem, int index);
044}