lazycollection.java

来自「OPIAM stands for Open Identity and Acces」· Java 代码 · 共 94 行

JAVA
94
字号
/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.persistence;

import opiam.admin.faare.service.UserContext;

import java.util.ArrayList;
import java.util.Iterator;


/**
*
*  Class which implements the Collection interface and the lazy loading model.
*/
public abstract class LazyCollection
{
    /**
     * Creates a new LazyCollection object.
     *
     * @param enclosing Dname of entry containing attribute being loaded.
     * @param atts Name of attribute being loaded.
     * @param userContext User context.
     */
    public LazyCollection(String enclosing, ArrayList atts,
        UserContext userContext)
    {
    }

    /**
     * Gets identifiers of elements in collections.
     *
     * @return List of identifiers.
     */
    public abstract ArrayList getIdentitiesList();

    /**
     * Gets number of elements in collection.
     *
     * @return Number of elements.
     */
    public abstract int size();

    //DW/2553/BeginPatch
    /**
     * Gets an iterator on collection items.
     *
     * @return Iterator.
     */
    public abstract Iterator iterator();

    /**
     * Displays collection.
     *
     * @return String formatted collection
     * Same format as Collection : "[value1,...,valuen]"
     */
    public String toString()
    {
        StringBuffer buf = new StringBuffer();
        Iterator e = iterator();
        buf.append("[");

        int maxIndex = size() - 1;

        for (int i = 0; i <= maxIndex; i++)
        {
            try
            {
                buf.append(String.valueOf(e.next()));
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }

            if (i < maxIndex)
            {
                buf.append(", ");
            }
        }

        buf.append("]");

        return buf.toString();
    }

    //DW/2553/EndPatch
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?