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