1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.view.facelets.pool.impl;
20
21 import java.io.Serializable;
22 import java.util.Arrays;
23 import java.util.Locale;
24
25
26
27
28
29 public class MetadataViewKeyImpl extends MetadataViewKey implements Serializable
30 {
31 private final Locale locale;
32
33 private final String viewId;
34
35 private final String[] contracts;
36
37 private final String renderKitId;
38
39 public MetadataViewKeyImpl(String viewId, String renderKitId, Locale locale)
40 {
41 this.viewId = viewId;
42 this.renderKitId = renderKitId;
43 this.locale = locale;
44 this.contracts = null;
45 }
46
47 public MetadataViewKeyImpl(String viewId, String renderKitId, Locale locale, String[] contracts)
48 {
49 this.viewId = viewId;
50 this.renderKitId = renderKitId;
51 this.locale = locale;
52 this.contracts = contracts;
53 }
54
55
56
57
58 public Locale getLocale()
59 {
60 return locale;
61 }
62
63
64
65
66 @Override
67 public String getViewId()
68 {
69 return viewId;
70 }
71
72
73
74
75 public String[] getContracts()
76 {
77 return Arrays.copyOf(contracts, contracts.length);
78 }
79
80
81
82
83 public String getRenderKitId()
84 {
85 return renderKitId;
86 }
87
88 @Override
89 public int hashCode()
90 {
91 int hash = 7;
92 hash = 17 * hash + (this.locale != null ? this.locale.hashCode() : 0);
93 hash = 17 * hash + (this.viewId != null ? this.viewId.hashCode() : 0);
94 hash = 17 * hash + Arrays.deepHashCode(this.contracts);
95 hash = 17 * hash + (this.renderKitId != null ? this.renderKitId.hashCode() : 0);
96 return hash;
97 }
98
99 @Override
100 public boolean equals(Object obj)
101 {
102 if (obj == null)
103 {
104 return false;
105 }
106 if (getClass() != obj.getClass())
107 {
108 return false;
109 }
110 final MetadataViewKeyImpl other = (MetadataViewKeyImpl) obj;
111 if (this.locale != other.locale && (this.locale == null || !this.locale.equals(other.locale)))
112 {
113 return false;
114 }
115 if ((this.viewId == null) ? (other.viewId != null) : !this.viewId.equals(other.viewId))
116 {
117 return false;
118 }
119 if (!Arrays.deepEquals(this.contracts, other.contracts))
120 {
121 return false;
122 }
123 if ((this.renderKitId == null) ? (other.renderKitId != null) : !this.renderKitId.equals(other.renderKitId))
124 {
125 return false;
126 }
127 return true;
128 }
129
130 }