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 org.apache.juneau.internal.ClassUtils.*; 016 017import org.apache.juneau.httppart.*; 018import org.apache.juneau.urlencoding.*; 019 020/** 021 * Represents the metadata about an annotated argument of a method on a remote proxy 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-client.3rdPartyProxies'>Overview > juneau-rest-client > Interface Proxies Against 3rd-party REST Interfaces</a> 026 * </ul> 027 */ 028public class RemoteMethodArg { 029 030 /** The argument name. Can be blank. */ 031 public final String name; 032 033 /** The zero-based index of the argument on the Java method. */ 034 public final int index; 035 036 /** The value is skipped if it's null/empty. */ 037 public final boolean skipIfNE; 038 039 /** The serializer used for converting objects to strings. */ 040 public final HttpPartSerializer serializer; 041 042 /** 043 * Constructor. 044 * 045 * @param name The argument name pulled from name(). 046 * @param name2 The argument name pulled from value(). 047 * @param index The zero-based index of the argument on the Java method. 048 * @param skipIfNE The value is skipped if it's null/empty. 049 * @param serializer 050 * The class to use for serializing headers, query parameters, form-data parameters, and path variables. 051 * If {@link UrlEncodingSerializer}, then the url-encoding serializer defined on the client will be used. 052 */ 053 protected RemoteMethodArg(String name, String name2, int index, boolean skipIfNE, Class<? extends HttpPartSerializer> serializer) { 054 this.name = name.isEmpty() ? name2 : name; 055 this.index = index; 056 this.skipIfNE = skipIfNE; 057 this.serializer = newInstance(HttpPartSerializer.class, serializer); 058 } 059}