1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.internal.context;
21
22 public final class MiscCacheKey {
23 private final ClientPropertiesKey cacheKey;
24 private final String name;
25 private final int hashCode;
26
27 public MiscCacheKey(ClientPropertiesKey cacheKey, String name) {
28 this.cacheKey = cacheKey;
29 this.name = name;
30 hashCode = calcHashCode();
31 }
32
33 @Override
34 public boolean equals(Object o) {
35 if (this == o) {
36 return true;
37 }
38 if (o == null || getClass() != o.getClass()) {
39 return false;
40 }
41
42 MiscCacheKey that = (MiscCacheKey) o;
43
44 return cacheKey.equals(that.cacheKey) && name.equals(that.name);
45
46 }
47
48 private int calcHashCode() {
49 int result;
50 result = cacheKey.hashCode();
51 result = 31 * result + name.hashCode();
52 return result;
53 }
54
55 @Override
56 public int hashCode() {
57 return hashCode;
58 }
59
60 @Override
61 public String toString() {
62 return "MiscCacheKey(" + cacheKey + "," + name + "," + hashCode + ')';
63 }
64 }