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 * <ul class='seealso'>
033 *    <li class='link'>{@doc juneau-rest-server.HttpPartAnnotations.HasQuery}
034 * </ul>
035 */
036@Documented
037@Target({PARAMETER,TYPE})
038@Retention(RUNTIME)
039@Inherited
040public @interface HasQuery {
041
042   /**
043    * URL query parameter name.
044    *
045    * Required. The name of the parameter. Parameter names are case sensitive.
046    *
047    * <ul class='notes'>
048    *    <li>
049    *       The format is plain-text.
050    * </ul>
051    */
052   String name() default "";
053
054   /**
055    * A synonym for {@link #name()}.
056    *
057    * <p>
058    * Allows you to use shortened notation if you're only specifying the name.
059    *
060    * <p>
061    * The following are completely equivalent ways of defining the existence of a query entry:
062    * <p class='bcode w800'>
063    *    <jk>public</jk> Order placeOrder(<jk>@HasQuery</jk>(name=<js>"petId"</js>) <jk>boolean</jk> hasPetId) {...}
064    * </p>
065    * <p class='bcode w800'>
066    *    <jk>public</jk> Order placeOrder(<jk>@HasQuery</jk>(<js>"petId"</js>) <jk>boolean</jk> hasPetId) {...}
067    * </p>
068    */
069   String value() default "";
070}