1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.apache.ws.scout.registry.infomodel; |
18 | |
|
19 | |
import java.util.Locale; |
20 | |
|
21 | |
import javax.xml.registry.infomodel.LocalizedString; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public class LocalizedStringImpl implements LocalizedString |
30 | |
{ |
31 | |
private String charsetName; |
32 | |
private Locale locale; |
33 | |
private String value; |
34 | |
|
35 | |
public LocalizedStringImpl() |
36 | 0 | { |
37 | 0 | this.locale = Locale.getDefault(); |
38 | 0 | this.charsetName = LocalizedString.DEFAULT_CHARSET_NAME; |
39 | 0 | } |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
public LocalizedStringImpl(Locale locale, String value, String charsetName) |
49 | 0 | { |
50 | 0 | if (locale == null) |
51 | |
{ |
52 | 0 | throw new IllegalArgumentException("locale cannot be null"); |
53 | |
} |
54 | 0 | if (charsetName == null) |
55 | |
{ |
56 | 0 | throw new IllegalArgumentException("charsetName cannot be null"); |
57 | |
} |
58 | 0 | this.locale = locale; |
59 | 0 | this.value = value; |
60 | 0 | this.charsetName = charsetName; |
61 | 0 | } |
62 | |
|
63 | |
public String getCharsetName() |
64 | |
{ |
65 | 0 | return charsetName; |
66 | |
} |
67 | |
|
68 | |
public Locale getLocale() |
69 | |
{ |
70 | 0 | return locale; |
71 | |
} |
72 | |
|
73 | |
public String getValue() |
74 | |
{ |
75 | 0 | return value; |
76 | |
} |
77 | |
|
78 | |
public void setCharsetName(String charsetName) |
79 | |
{ |
80 | 0 | if (charsetName == null) |
81 | |
{ |
82 | 0 | throw new IllegalArgumentException("charsetName cannot be null"); |
83 | |
} |
84 | 0 | this.charsetName = charsetName; |
85 | 0 | } |
86 | |
|
87 | |
public void setLocale(Locale locale) |
88 | |
{ |
89 | 0 | if (locale == null) |
90 | |
{ |
91 | 0 | throw new IllegalArgumentException("locale cannot be null"); |
92 | |
} |
93 | 0 | this.locale = locale; |
94 | 0 | } |
95 | |
|
96 | |
public void setValue(String value) |
97 | |
{ |
98 | 0 | this.value = value; |
99 | 0 | } |
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
public boolean equals(Object o) |
110 | |
{ |
111 | 0 | if (this == o) return true; |
112 | 0 | if (!(o instanceof LocalizedStringImpl)) return false; |
113 | 0 | final LocalizedStringImpl localizedString = (LocalizedStringImpl) o; |
114 | 0 | if (!charsetName.equals(localizedString.charsetName)) return false; |
115 | 0 | if (!locale.equals(localizedString.locale)) return false; |
116 | 0 | if (value != null ? !value.equals(localizedString.value) : localizedString.value != null) return false; |
117 | 0 | return true; |
118 | |
} |
119 | |
|
120 | |
public int hashCode() |
121 | |
{ |
122 | |
int result; |
123 | 0 | result = charsetName.hashCode(); |
124 | 0 | result = 29 * result + locale.hashCode(); |
125 | 0 | result = 29 * result + (value != null ? value.hashCode() : 0); |
126 | 0 | return result; |
127 | |
} |
128 | |
|
129 | |
public String toString() |
130 | |
{ |
131 | 0 | return value; |
132 | |
} |
133 | |
} |