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
020import org.apache.juneau.httppart.*;
021import org.apache.juneau.urlencoding.*;
022
023/**
024 * Annotation applied to Java method arguments of interface proxies to denote a bean with remoteable annotations.
025 * 
026 * <h5 class='section'>Example:</h5>
027 * <p class='bcode'>
028 *    <ja>@Remoteable</ja>(path=<js>"/myproxy"</js>)
029 *    <jk>public interface</jk> MyProxy {
030 * 
031 *       <ja>@RemoteMethod</ja>(path=<js>"/mymethod/{p1}/{p2}"</js>)
032 *       String myProxyMethod(<ja>@RequestBean</ja> MyRequestBean bean);
033 *    }
034 * 
035 *    <jk>public interface</jk> MyRequestBean {
036 * 
037 *       <ja>@Path</ja>
038 *       String getP1();
039 * 
040 *       <ja>@Path</ja>(<js>"p2"</js>)
041 *       String getX();
042 * 
043 *       <ja>@Query</ja>
044 *       String getQ1();
045 * 
046 *       <ja>@Query</ja>
047 *       <ja>@BeanProperty</ja>(name=<js>"q2"</js>)
048 *       String getQuery2();
049 * 
050 *       <ja>@QueryIfNE</ja>(<js>"q3"</js>)
051 *       String getQuery3();
052 * 
053 *       <ja>@QueryIfNE</ja>
054 *       Map&lt;String,Object&gt; getExtraQueries();
055 * 
056 *       <ja>@FormData</ja>
057 *       String getF1();
058 * 
059 *       <ja>@FormData</ja>
060 *       <ja>@BeanProperty</ja>(name=<js>"f2"</js>)
061 *       String getFormData2();
062 * 
063 *       <ja>@FormDataIfNE</ja>(<js>"f3"</js>)
064 *       String getFormData3();
065 * 
066 *       <ja>@FormDataIfNE</ja>
067 *       Map&lt;String,Object&gt; getExtraFormData();
068 * 
069 *       <ja>@Header</ja>
070 *       String getH1();
071 * 
072 *       <ja>@Header</ja>
073 *       <ja>@BeanProperty</ja>(name=<js>"H2"</js>)
074 *       String getHeader2();
075 * 
076 *       <ja>@HeaderIfNE</ja>(<js>"H3"</js>)
077 *       String getHeader3();
078 * 
079 *       <ja>@HeaderIfNE</ja>
080 *       Map&lt;String,Object&gt; getExtraHeaders();
081 *    }
082 * </p>
083 * 
084 * <h5 class='section'>See Also:</h5>
085 * <ul class='doctree'>
086 *    <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>
087 * </ul>
088 */
089@Documented
090@Target(PARAMETER)
091@Retention(RUNTIME)
092@Inherited
093public @interface RequestBean {
094
095   /**
096    * Specifies the {@link HttpPartSerializer} class used for serializing values to strings.
097    * 
098    * <p>
099    * The default value defaults to the using the part serializer defined on the client which by default is
100    * {@link UrlEncodingSerializer}.
101    * 
102    * <p>
103    * This annotation is provided to allow values to be custom serialized.
104    */
105   Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class;
106}