001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.http.annotation;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.lang.annotation.*;
019
020/**
021 * REST has-query-parameter annotation.
022 *
023 * <p>
024 * Identifies whether or not an HTTP request has the specified query parameter.
025 *
026 * <p>
027 * Can be used in the following locations:
028 * <ul>
029 *    <li>Arguments and argument-types of server-side <ja>@RestMethod</ja>-annotated methods.
030 * </ul>
031 *
032 * <h5 class='section'>See Also:</h5>
033 * <ul>
034 *    <li class='link'>{@doc juneau-rest-server.HttpPartAnnotations.HasQuery}
035 * </ul>
036 */
037@Documented
038@Target({PARAMETER,TYPE})
039@Retention(RUNTIME)
040@Inherited
041public @interface HasQuery {
042
043   /**
044    * URL query parameter name.
045    *
046    * Required. The name of the parameter. Parameter names are case sensitive.
047    *
048    * <h5 class='section'>Notes:</h5>
049    * <ul class='spaced-list'>
050    *    <li>
051    *       The format is plain-text.
052    * </ul>
053    */
054   String name() default "";
055
056   /**
057    * A synonym for {@link #name()}.
058    *
059    * <p>
060    * Allows you to use shortened notation if you're only specifying the name.
061    *
062    * <p>
063    * The following are completely equivalent ways of defining the existence of a query entry:
064    * <p class='bcode w800'>
065    *    <jk>public</jk> Order placeOrder(<jk>@HasQuery</jk>(name=<js>"petId"</js>) <jk>boolean</jk> hasPetId) {...}
066    * </p>
067    * <p class='bcode w800'>
068    *    <jk>public</jk> Order placeOrder(<jk>@HasQuery</jk>(<js>"petId"</js>) <jk>boolean</jk> hasPetId) {...}
069    * </p>
070    */
071   String value() default "";
072}