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