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-form-data annotation.
022 *
023 * Identifies whether or not an HTTP request has the specified multipart form POST parameter.
024 *
025 * <p>
026 * Can be used in the following locations:
027 * <ul>
028 *    <li>Arguments and argument-types of server-side <ja>@RestMethod</ja>-annotated methods.
029 * </ul>
030 *
031 * <h5 class='section'>See Also:</h5>
032 * <ul>
033 *    <li class='link'>{@doc juneau-rest-server.HttpPartAnnotations.HasFormData}
034 * </ul>
035 */
036@Documented
037@Target({PARAMETER,TYPE})
038@Retention(RUNTIME)
039@Inherited
040public @interface HasFormData {
041
042   /**
043    * FORM parameter name.
044    *
045    * Required. The name of the parameter. Parameter names are case sensitive.
046    *
047    * <h5 class='section'>Notes:</h5>
048    * <ul class='spaced-list'>
049    *    <li>
050    *       The format is plain-text.
051    * </ul>
052    */
053   String name() default "";
054
055   /**
056    * A synonym for {@link #name()}.
057    *
058    * <p>
059    * Allows you to use shortened notation if you're only specifying the name.
060    *
061    * <p>
062    * The following are completely equivalent ways of defining the existence of a form post entry:
063    * <p class='bcode w800'>
064    *    <jk>public</jk> Order placeOrder(<jk>@HasFormData</jk>(name=<js>"petId"</js>) <jk>boolean</jk> hasPetId) {...}
065    * </p>
066    * <p class='bcode w800'>
067    *    <jk>public</jk> Order placeOrder(<jk>@HasFormData</jk>(<js>"petId"</js>) <jk>boolean</jk> hasPetId) {...}
068    * </p>
069    */
070   String value() default "";
071}