001 /** 002 * 003 * Copyright 2003-2004 The Apache Software Foundation 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * 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 */ 017 018 package org.apache.geronimo.gbean; 019 020 import java.io.Serializable; 021 import java.util.ArrayList; 022 import java.util.Arrays; 023 import java.util.Collections; 024 import java.util.List; 025 026 /** 027 * Describes an operation on a GBean. 028 * 029 * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $ 030 */ 031 public class GOperationInfo implements Serializable { 032 /** 033 * The name of this method. 034 */ 035 private final String name; 036 037 /** 038 * Parameters of this method. 039 */ 040 private final List parameters; 041 042 /** 043 * Target method name. 044 */ 045 private final String methodName; 046 047 public GOperationInfo(String name) { 048 this(name, name, Collections.EMPTY_LIST); 049 } 050 051 public GOperationInfo(String name, Class[] paramTypes) { 052 this.name = this.methodName = name; 053 String[] args = new String[paramTypes.length]; 054 for (int i = 0; i < args.length; i++) { 055 args[i] = paramTypes[i].getName(); 056 } 057 this.parameters = Collections.unmodifiableList(Arrays.asList(args)); 058 } 059 060 public GOperationInfo(String name, String[] paramTypes) { 061 this(name, name, Arrays.asList(paramTypes)); 062 } 063 064 public GOperationInfo(String name, List parameters) { 065 this(name, name, parameters); 066 } 067 068 public GOperationInfo(String name, String methodName, List parameters) { 069 this.name = name; 070 this.methodName = methodName; 071 this.parameters = Collections.unmodifiableList(new ArrayList(parameters)); 072 } 073 074 public String getName() { 075 return name; 076 } 077 078 public String getMethodName() { 079 return methodName; 080 } 081 082 public List getParameterList() { 083 return parameters; 084 } 085 086 public String toString() { 087 return "[GOperationInfo: name=" + name + " parameters=" + parameters + "]"; 088 } 089 }