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 {
37 this.locale = Locale.getDefault();
38 this.charsetName = LocalizedString.DEFAULT_CHARSET_NAME;
39 }
40
41
42
43
44
45
46
47
48 public LocalizedStringImpl(Locale locale, String value, String charsetName)
49 {
50 if (locale == null)
51 {
52 throw new IllegalArgumentException("locale cannot be null");
53 }
54 if (charsetName == null)
55 {
56 throw new IllegalArgumentException("charsetName cannot be null");
57 }
58 this.locale = locale;
59 this.value = value;
60 this.charsetName = charsetName;
61 }
62
63 public String getCharsetName()
64 {
65 return charsetName;
66 }
67
68 public Locale getLocale()
69 {
70 return locale;
71 }
72
73 public String getValue()
74 {
75 return value;
76 }
77
78 public void setCharsetName(String charsetName)
79 {
80 if (charsetName == null)
81 {
82 throw new IllegalArgumentException("charsetName cannot be null");
83 }
84 this.charsetName = charsetName;
85 }
86
87 public void setLocale(Locale locale)
88 {
89 if (locale == null)
90 {
91 throw new IllegalArgumentException("locale cannot be null");
92 }
93 this.locale = locale;
94 }
95
96 public void setValue(String value)
97 {
98 this.value = value;
99 }
100
101
102
103
104
105
106
107
108
109 public boolean equals(Object o)
110 {
111 if (this == o) return true;
112 if (!(o instanceof LocalizedStringImpl)) return false;
113 final LocalizedStringImpl localizedString = (LocalizedStringImpl) o;
114 if (!charsetName.equals(localizedString.charsetName)) return false;
115 if (!locale.equals(localizedString.locale)) return false;
116 if (value != null ? !value.equals(localizedString.value) : localizedString.value != null) return false;
117 return true;
118 }
119
120 public int hashCode()
121 {
122 int result;
123 result = charsetName.hashCode();
124 result = 29 * result + locale.hashCode();
125 result = 29 * result + (value != null ? value.hashCode() : 0);
126 return result;
127 }
128
129 public String toString()
130 {
131 return value;
132 }
133 }