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