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

org.apache.jackrabbit.commons.flat.Sequence Maven / Gradle / Ivy

There is a newer version: 2.0.10
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with this
 * work for additional information regarding copyright ownership. The ASF
 * licenses this file to You under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.apache.jackrabbit.commons.flat;

import javax.jcr.AccessDeniedException;
import javax.jcr.Item;
import javax.jcr.ItemNotFoundException;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;

import java.util.Iterator;

/**
 * Interface for accessing JCR {@link Item}s sequentially through an
 * {@link Iterator} or looking them up through a key.
 *
 * @param  extends <Item>
 */
public interface Sequence extends Iterable {

    /**
     * Iterator for the {@link Item}s in this sequence. The order of the items
     * is implementation specific.
     *
     * @see java.lang.Iterable#iterator()
     */
    Iterator iterator();

    /**
     * Retrieve an {@link Item} from this sequence by its key. If
     * the sequence does not contain the key this method throws an
     * {@link ItemNotFoundException}.
     *
     * @param key The key of the item to retrieve. Must not be
     *            null.
     * @return The item belonging to key.
     * @throws ItemNotFoundException
     * @throws RepositoryException
     */
    T getItem(String key) throws AccessDeniedException, PathNotFoundException, ItemNotFoundException,
            RepositoryException;

    /**
     * Determine whether this sequence contains a specific key.
     *
     * @param key The key to look up.
     * @return true if this sequence contains key.
     *         False otherwise.
     * @throws RepositoryException
     */
    boolean hasItem(String key) throws RepositoryException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy