001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel.util.component; 018 019public class ApiMethodArg { 020 private final String name; 021 private final Class<?> type; 022 private final String typeArgs; 023 024 public ApiMethodArg(String name, Class<?> type, String typeArgs) { 025 this.name = name; 026 this.type = type; 027 this.typeArgs = typeArgs; 028 } 029 030 public String getName() { 031 return this.name; 032 } 033 034 public Class<?> getType() { 035 return this.type; 036 } 037 038 public String getTypeArgs() { 039 return this.typeArgs; 040 } 041 042 @Override 043 public String toString() { 044 StringBuilder builder = new StringBuilder(); 045 builder.append(type.getCanonicalName()); 046 if (typeArgs != null) { 047 builder.append("<").append(typeArgs).append(">"); 048 } 049 builder.append(" ").append(name); 050 return builder.toString(); 051 } 052 053 public static ApiMethodArg arg(String name, Class<?> type) { 054 return new ApiMethodArg(name, type, null); 055 } 056 057 public static ApiMethodArg arg(String name, Class<?> type, String typeArgs) { 058 return new ApiMethodArg(name, type, typeArgs); 059 } 060}