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.rest.annotation;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.lang.annotation.*;
019
020/**
021 * Annotation that can be applied to a parameter of a {@link RestMethod @RestMethod} annotated method to identify it as the HTTP
022 * method.
023 *
024 * <p>
025 * Typically used for HTTP method handlers of type <js>"*"</js> (i.e. handle all requests).
026 *
027 * <h5 class='section'>Example:</h5>
028 * <p class='bcode w800'>
029 *    <ja>@RestMethod</ja>(name=<js>"*"</js>)
030 *    <jk>public void</jk> doAnything(RestRequest req, RestResponse res, <ja>@Method</ja> String method) {
031 *       ...
032 *    }
033 * </p>
034 *
035 * <p>
036 * This is functionally equivalent to the following code...
037 * <p class='bcode w800'>
038 *    <ja>@RestMethod</ja>(name=<js>"*"</js>)
039 *    <jk>public void</jk> doAnything(RestRequest req, RestResponse res) {
040 *       String method = req.getMethod();
041 *       ...
042 *    }
043 * </p>
044 *
045 * <ul class='seealso'>
046 *    <li class='link'>{@doc RestmParameters}
047 * </ul>
048 */
049@Documented
050@Target(PARAMETER)
051@Retention(RUNTIME)
052@Inherited
053public @interface Method {
054}