KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ioc > management > ManagementOperationInfo


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6
7 package org.jfox.ioc.management;
8
9 import java.io.Serializable JavaDoc;
10 import java.lang.reflect.Method JavaDoc;
11
12 import org.jfox.ioc.util.Methods;
13
14 /**
15  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
16  */

17
18 public class ManagementOperationInfo implements Serializable JavaDoc, Comparable JavaDoc {
19     private String JavaDoc description;
20     private Method JavaDoc method;
21     private String JavaDoc hash = null;
22
23     public ManagementOperationInfo(Method JavaDoc method) {
24         this(method, method.getName());
25     }
26
27     public ManagementOperationInfo(Method JavaDoc method, String JavaDoc description) {
28         this.method = method;
29         this.description = description;
30     }
31
32     public String JavaDoc getName() {
33         return method.getName();
34     }
35
36     public String JavaDoc getDescription() {
37         return description;
38     }
39
40     public Class JavaDoc[] getParameterTypes() {
41         return method.getParameterTypes();
42     }
43
44     public Class JavaDoc getReturnType() {
45         return method.getReturnType();
46     }
47
48     public String JavaDoc getMethodHashCode() {
49         if(hash == null) {
50             hash = "" + Methods.getMethodHash(method);
51         }
52         return hash;
53     }
54
55
56     public String JavaDoc toString() {
57         return "ManagementOperationInfo{" +
58                 "hash='" + hash + "'" +
59                 ", description='" + description + "'" +
60                 ", method=" + method +
61                 "}";
62     }
63
64     public int compareTo(Object JavaDoc o) {
65         if(o instanceof ManagementOperationInfo) {
66             return getName().compareTo(((ManagementOperationInfo) o).getName());
67         }
68         return 0;
69     }
70
71     public boolean isGetter() {
72         return Methods.isGetMethod(method);
73     }
74
75     public Method JavaDoc getMethod() {
76         return method;
77     }
78
79     public static void main(String JavaDoc[] args) {
80
81     }
82 }
83
84
Popular Tags