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 PropertyCacheKey {
23 private final ClientPropertiesKey cacheKey;
24 private final String name;
25 private final String key;
26 private final int hashCode;
27
28 public PropertyCacheKey(ClientPropertiesKey cacheKey, String name, String key) {
29 this.cacheKey = cacheKey;
30 this.name = name;
31 this.key = key;
32 hashCode = calcHashCode();
33 }
34
35 @Override
36 public boolean equals(Object o) {
37 if (this == o) {
38 return true;
39 }
40 if (o == null || getClass() != o.getClass()) {
41 return false;
42 }
43
44 PropertyCacheKey that = (PropertyCacheKey) o;
45
46 return cacheKey.equals(that.cacheKey) && key.equals(that.key) && name.equals(that.name);
47
48 }
49
50 private int calcHashCode() {
51 int result;
52 result = cacheKey.hashCode();
53 result = 31 * result + name.hashCode();
54 result = 31 * result + key.hashCode();
55 return result;
56 }
57
58 @Override
59 public int hashCode() {
60 return hashCode;
61 }
62
63 @Override
64 public String toString() {
65 return "PropertyCacheKey(" + cacheKey + "," + name + "," + key + "," + hashCode + '}';
66 }
67 }