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 RestOp @RestOp} 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='bjava'>
029 *    <ja>@RestOp</ja>(method=<js>"*"</js>)
030 *    <jk>public void</jk> doAnything(RestRequest <jv>req</jv>, RestResponse <jv>res</jv>, <ja>@Method</ja> String <jv>method</jv>) {
031 *       ...
032 *    }
033 * </p>
034 *
035 * <p>
036 * This is functionally equivalent to the following code...
037 * <p class='bjava'>
038 *    <ja>@RestOp</ja>(method=<js>"*"</js>)
039 *    <jk>public void</jk> doAnything(RestRequest <jv>req</jv>, RestResponse <jv>res</jv>) {
040 *       String <jv>method</jv> = <jv>req</jv>.getMethod();
041 *       ...
042 *    }
043 * </p>
044 *
045 * <h5 class='section'>See Also:</h5><ul>
046 *    <li class='link'><a class="doclink" href="../../../../../index.html#jrs.RestOpAnnotatedMethods">@RestOp-Annotated Methods</a>
047
048 * </ul>
049 */
050@Target(PARAMETER)
051@Retention(RUNTIME)
052@Inherited
053public @interface Method {
054}