All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.granite.ui.components.ds.DataSource Maven / Gradle / Ivy

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2013 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/
package com.adobe.granite.ui.components.ds;

import java.util.Iterator;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

import org.apache.sling.api.resource.Resource;
import org.osgi.annotation.versioning.ConsumerType;

/**
 * DataSource is an abstract collection of {@link Resource}.
 */
@ConsumerType
public interface DataSource {

    /**
     * Returns the data.
     *
     * @return The iterator of the data.
     */
    @Nonnull
    Iterator iterator();

    /**
     * Returns the offset of this datasource.
     *
     * It returns {@code null} by default.
     *
     * @return The offset of the datasource, or {@code null} when the offset is
     *         unknown or not set.
     */
    @CheckForNull
    default Long getOffset() {
        return null;
    }

    /**
     * Returns the limit of this datasource.
     *
     * It returns {@code null} by default.
     *
     * @return The limit of the datasource, or {@code null} when the offset is
     *         unknown or not set.
     */
    @CheckForNull
    default Long getLimit() {
        return null;
    }

    /**
     * Returns the total count or the total as far as it is known.
     *
     * It returns {@code null} by default.
     *
     * @return The total count, or {@code null} if it is not known.
     */
    @CheckForNull
    default Long getGuessTotal() {
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy