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