1
14
15 package com.liferay.portal.kernel.util;
16
17 import java.io.Serializable;
18
19 import java.lang.reflect.Method;
20
21 import java.util.Map;
22
23
28 public class MethodKey implements Serializable {
29
30 public MethodKey(String className, String methodName, Class<?>[] types) {
31 this(null, null, className, methodName, types);
32 }
33
34 public MethodKey(
35 Map<String, Class<?>> classesMap, Map<MethodKey, Method> methodsMap,
36 String className, String methodName, Class<?>[] types) {
37
38 _classesMap = classesMap;
39 _methodsMap = methodsMap;
40 _className = className;
41 _methodName = methodName;
42 _types = types;
43 }
44
45 public Map<String, Class<?>> getClassesMap() {
46 return _classesMap;
47 }
48
49 public Map<MethodKey, Method> getMethodsMap() {
50 return _methodsMap;
51 }
52
53 public String getClassName() {
54 return _className;
55 }
56
57 public String getMethodName() {
58 return _methodName;
59 }
60
61 public Class<?>[] getTypes() {
62 return _types;
63 }
64
65 public boolean equals(Object obj) {
66 if (obj == null) {
67 return false;
68 }
69
70 MethodKey methodKey = (MethodKey)obj;
71
72 if (toString().equals(methodKey.toString())) {
73 return true;
74 }
75 else {
76 return false;
77 }
78 }
79
80 public int hashCode() {
81 return toString().hashCode();
82 }
83
84 public String toString() {
85 return _toString();
86 }
87
88 private String _toString() {
89 if (_toString == null) {
90 StringBundler sb = new StringBundler();
91
92 sb.append(_className);
93 sb.append(_methodName);
94
95 if ((_types != null) && (_types.length > 0)) {
96 sb.append(StringPool.DASH);
97
98 for (Class<?> type : _types) {
99 sb.append(type.getName());
100 }
101 }
102
103 _toString = sb.toString();
104 }
105
106 return _toString;
107 }
108
109 private Map<String, Class<?>> _classesMap;
110 private Map<MethodKey, Method> _methodsMap;
111 private String _className;
112 private String _methodName;
113 private Class<?>[] _types;
114 private String _toString;
115
116 }