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.client.remote; 014 015import static org.apache.juneau.internal.ClassUtils.*; 016 017import org.apache.juneau.http.annotation.*; 018import org.apache.juneau.httppart.*; 019import org.apache.juneau.httppart.bean.*; 020 021/** 022 * Represents the metadata about an {@link Request}-annotated argument of a method on a REST proxy class. 023 * 024 * <h5 class='section'>See Also:</h5> 025 * <ul class='doctree'> 026 * <li class='link'>{@doc juneau-rest-client.RestProxies} 027 * </ul> 028 */ 029public final class RemoteMethodBeanArg { 030 031 private final int index; 032 private final RequestBeanMeta meta; 033 private final HttpPartSerializer serializer; 034 035 RemoteMethodBeanArg(int index, Class<? extends HttpPartSerializer> serializer, RequestBeanMeta meta) { 036 this.index = index; 037 this.serializer = newInstance(HttpPartSerializer.class, serializer); 038 this.meta = meta; 039 } 040 041 /** 042 * Returns the index of the parameter in the method that is a request bean. 043 * 044 * @return The index of the parameter in the method that is a request bean. 045 */ 046 public int getIndex() { 047 return index; 048 } 049 050 /** 051 * Returns the serializer to use for serializing parts on the request bean. 052 * 053 * @return The serializer to use for serializing parts on the request bean, or <jk>null</jk> if not defined. 054 */ 055 public HttpPartSerializer getSerializer() { 056 return serializer; 057 } 058 059 /** 060 * Returns metadata on the request bean. 061 * 062 * @return Metadata about the bean. 063 */ 064 public RequestBeanMeta getMeta() { 065 return meta; 066 } 067}