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.remoteable;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.lang.annotation.*;
019
020/**
021 * Identifies a remote proxy interface against a REST interface.
022 * 
023 * <h5 class='section'>See Also:</h5>
024 * <ul class='doctree'>
025 *    <li class='link'><a class='doclink' href='../../../../overview-summary.html#juneau-rest-server.RemoteableProxies'>Overview &gt; juneau-rest-server &gt; Remoteable Proxies</a>
026 *    <li class='link'><a class='doclink' href='../../../../overview-summary.html#juneau-rest-client.3rdPartyProxies'>Overview &gt; juneau-rest-client &gt; Interface Proxies Against 3rd-party REST Interfaces</a>
027 * </ul>
028 */
029@Documented
030@Target({TYPE,METHOD})
031@Retention(RUNTIME)
032@Inherited
033public @interface Remoteable {
034
035   /**
036    * The absolute or relative path of the REST service.
037    * 
038    * <p>
039    * When a relative path is specified, it's relative to the root-url defined on the <code>RestClient</code> used
040    * to instantiate the interface.
041    * 
042    * <p>
043    * When no path is specified, the path is assumed to be the class name (e.g.
044    * <js>"http://localhost/root-url/org.foo.MyInterface"</js>)
045    */
046   String path() default "";
047
048   /**
049    * Identifies which methods on the interface should be exposed through the proxy.
050    * 
051    * <p>
052    * The options are:
053    * <ul>
054    *    <li><js>"DECLARED"</js> (default) - Only methods declared on the immediate interface/class are exposed.
055    *       Methods on parent interfaces/classes are ignored.
056    *    <li><js>"ANNOTATED"</js> - Only methods annotated with {@link RemoteMethod} are exposed.
057    *    <li><js>"ALL"</js> - All methods defined on the interface or class are exposed.
058    * </ul>
059    */
060   String expose() default "DECLARED";
061
062   /**
063    * Defines the methodology to use for the path names of the methods when not explicitly defined via
064    * {@link RemoteMethod#path() @RemoteMethod.path()}.
065    * 
066    * <p>
067    * The options are:
068    * <ul>
069    *    <li><js>"NAME"</js> (default) - Use the method name (e.g. "myMethod").
070    *    <li><js>"SIGNATURE"</js> - Use the method signature (e.g. "myMethod(int,boolean,java.lang.String,int[][][])").
071    * </ul>
072    * <p>
073    * Note that if you use <js>"NAME"</js>, method names must be unique in the interface.
074    */
075   String methodPaths() default "NAME";
076}