001/**
002 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
003 *   This file is part of the LDP4j Project:
004 *     http://www.ldp4j.org/
005 *
006 *   Center for Open Middleware
007 *     http://www.centeropenmiddleware.com/
008 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
009 *   Copyright (C) 2014-2016 Center for Open Middleware.
010 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
011 *   Licensed under the Apache License, Version 2.0 (the "License");
012 *   you may not use this file except in compliance with the License.
013 *   You may obtain a copy of the License at
014 *
015 *             http://www.apache.org/licenses/LICENSE-2.0
016 *
017 *   Unless required by applicable law or agreed to in writing, software
018 *   distributed under the License is distributed on an "AS IS" BASIS,
019 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020 *   See the License for the specific language governing permissions and
021 *   limitations under the License.
022 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
023 *   Artifact    : org.ldp4j.framework:ldp4j-application-api:0.2.2
024 *   Bundle      : ldp4j-application-api-0.2.2.jar
025 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
026 */
027package org.ldp4j.application.ext;
028
029import java.io.Serializable;
030import java.util.Set;
031
032/**
033 * A collection of {@code Parameter}s, where is each parameter is indexed by its
034 * name.
035 */
036public interface Query extends Serializable {
037
038  /**
039   * Returns {@code true} if this query contains no parameters.
040   *
041   * @return {@code true} if this query contains no parameters
042   */
043  boolean isEmpty();
044
045  /**
046   * Returns the number of parameters in this query. If the query contains
047   * more than {@code Integer.MAX_VALUE} parameters, returns
048   * {@code Integer.MAX_VALUE}.
049   *
050   * @return the number of parameters in this query
051   */
052  int size();
053
054  /**
055   * Returns {@code true} if this query contains a parameter with the
056   * specified name.
057   *
058   * @param paramName
059   *            the name of the parameter
060   * @return {@code true} if this query contains a parameter with the
061   *         specified name.
062   */
063  boolean hasParameter(String paramName);
064
065  /**
066   * Returns the parameter with the specified name, or {@code null} if this
067   * query contains no parameter with that name.
068   *
069   * @param paramName
070   *            the name of the parameter that is to be returned
071   * @return the parameter with the specified name, or {@code null} if this
072   *         query does not contain a parameter with the specified name
073   * @throws NullPointerException
074   *             if the specified key is null
075   */
076  Parameter getParameter(String paramName);
077
078  /**
079   * Return the names of the parameters in this query. If no parameters are
080   * available and empty set will be returned.
081   *
082   * @return the names of the parameters in this query, or an empty set if the
083   *         query is empty
084   */
085  Set<String> parameterNames();
086
087}