KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > gbean > GOperationInfo


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 JavaDoc;
21 import java.util.ArrayList JavaDoc;
22 import java.util.Arrays JavaDoc;
23 import java.util.Collections JavaDoc;
24 import java.util.List JavaDoc;
25
26 /**
27  * Describes an operation on a GBean.
28  *
29  * @version $Rev: 485321 $ $Date: 2006-12-10 19:14:46 -0500 (Sun, 10 Dec 2006) $
30  */

31 public class GOperationInfo implements Serializable JavaDoc {
32     /**
33      * The name of this method.
34      */

35     private final String JavaDoc name;
36     
37     /**
38      * The return type of this method.
39      */

40     private final String JavaDoc type;
41     
42     /**
43      * Parameters of this method.
44      */

45     private final List JavaDoc parameters;
46
47     /**
48      * Target method name.
49      */

50     private final String JavaDoc methodName;
51
52     public GOperationInfo(String JavaDoc name, String JavaDoc type) {
53         this(name, name, Collections.EMPTY_LIST, type);
54     }
55
56     public GOperationInfo(String JavaDoc name, Class JavaDoc[] paramTypes, String JavaDoc type) {
57         this.name = this.methodName = name;
58         this.type = type;
59         String JavaDoc[] args = new String JavaDoc[paramTypes.length];
60         for (int i = 0; i < args.length; i++) {
61             args[i] = paramTypes[i].getName();
62         }
63         this.parameters = Collections.unmodifiableList(Arrays.asList(args));
64     }
65
66     public GOperationInfo(String JavaDoc name, String JavaDoc[] paramTypes, String JavaDoc type) {
67         this(name, name, Arrays.asList(paramTypes), type);
68     }
69     
70     public GOperationInfo(String JavaDoc name, List JavaDoc parameters, String JavaDoc type) {
71         this(name, name, parameters, type);
72     }
73     
74     public GOperationInfo(String JavaDoc name, String JavaDoc methodName, List JavaDoc parameters, String JavaDoc type) {
75         this.name = name;
76         this.type = type;
77         this.methodName = methodName;
78         this.parameters = Collections.unmodifiableList(new ArrayList JavaDoc(parameters));
79     }
80
81     public String JavaDoc getName() {
82         return name;
83     }
84     
85     public String JavaDoc getReturnType() {
86         return type;
87     }
88
89     public String JavaDoc getMethodName() {
90         return methodName;
91     }
92
93     public List JavaDoc getParameterList() {
94         return parameters;
95     }
96
97     public String JavaDoc toString() {
98         return "[GOperationInfo: name=" + name + " parameters=" + parameters + " type =" + type + "]";
99     }
100 }
101
Popular Tags