1 /** 2 * 3 * Copyright 2003-2004 The Apache Software Foundation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package org.apache.geronimo.gbean; 19 20 import java.io.Serializable; 21 import java.util.ArrayList; 22 import java.util.Arrays; 23 import java.util.Collections; 24 import java.util.List; 25 26 /** 27 * Describes an operation on a GBean. 28 * 29 * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $ 30 */ 31 public class GOperationInfo implements Serializable { 32 /** 33 * The name of this method. 34 */ 35 private final String name; 36 37 /** 38 * Parameters of this method. 39 */ 40 private final List parameters; 41 42 /** 43 * Target method name. 44 */ 45 private final String methodName; 46 47 public GOperationInfo(String name) { 48 this(name, name, Collections.EMPTY_LIST); 49 } 50 51 public GOperationInfo(String name, Class[] paramTypes) { 52 this.name = this.methodName = name; 53 String[] args = new String[paramTypes.length]; 54 for (int i = 0; i < args.length; i++) { 55 args[i] = paramTypes[i].getName(); 56 } 57 this.parameters = Collections.unmodifiableList(Arrays.asList(args)); 58 } 59 60 public GOperationInfo(String name, String[] paramTypes) { 61 this(name, name, Arrays.asList(paramTypes)); 62 } 63 64 public GOperationInfo(String name, List parameters) { 65 this(name, name, parameters); 66 } 67 68 public GOperationInfo(String name, String methodName, List parameters) { 69 this.name = name; 70 this.methodName = methodName; 71 this.parameters = Collections.unmodifiableList(new ArrayList(parameters)); 72 } 73 74 public String getName() { 75 return name; 76 } 77 78 public String getMethodName() { 79 return methodName; 80 } 81 82 public List getParameterList() { 83 return parameters; 84 } 85 86 public String toString() { 87 return "[GOperationInfo: name=" + name + " parameters=" + parameters + "]"; 88 } 89 }