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