View Javadoc
1   /*
2    * Copyright 2009 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.commons.ihe.xds.core.metadata;
17  
18  import lombok.EqualsAndHashCode;
19  import lombok.ToString;
20  
21  import javax.xml.bind.annotation.XmlAccessType;
22  import javax.xml.bind.annotation.XmlAccessorType;
23  import javax.xml.bind.annotation.XmlAttribute;
24  import javax.xml.bind.annotation.XmlTransient;
25  import javax.xml.bind.annotation.XmlType;
26  import javax.xml.bind.annotation.XmlValue;
27  import java.io.Serializable;
28  
29  /**
30   * Representation of a localized string.<p>
31   * <p>
32   * All members of this class are allowed to be <code>null</code>.
33   * 
34   * @author Jens Riemschneider
35   */
36  @XmlAccessorType(XmlAccessType.FIELD)
37  @XmlType(name = "LocalizedString")
38  @EqualsAndHashCode(doNotUseGetters = true)
39  @ToString(doNotUseGetters = true)
40  public class LocalizedString implements Serializable {
41      private static final long serialVersionUID = 4876325465142358849L;
42      
43      @XmlAttribute(name = "language")
44      private String lang;
45      @XmlTransient
46      private String charset;
47      @XmlValue
48      private String value;
49      
50      /**
51       * Constructs a localized string.
52       */
53      public LocalizedString() {
54          lang = "en-US";
55          charset = "UTF-8";
56      }
57  
58      /**
59       * Constructs a localized string.
60       * @param value
61       *          the value of the string.
62       * @param lang
63       *          the language that the string is in.
64       * @param charset
65       *          the charset used in the string.
66       */
67      public LocalizedString(String value, String lang, String charset) {
68          this.value = value;
69          this.lang = lang;
70          this.charset = charset;
71      }
72  
73      /**
74       * Constructs a localized string.
75       * @param value
76       *          the value of the string.
77       */
78      public LocalizedString(String value) {
79          this.value = value;
80          lang = "en-US";
81          charset = "UTF-8";
82      }
83  
84      /**
85       * @return the language that the string is in.
86       */
87      public String getLang() {
88          return lang;
89      }
90      
91      /**
92       * @param lang
93       *          the language that the string is in.
94       */
95      public void setLang(String lang) {
96          this.lang = lang;
97      }
98      
99      /**
100      * @return the charset used in the string.
101      */
102     public String getCharset() {
103         return charset;
104     }
105     
106     /**
107      * @param charset
108      *          the charset used in the string.
109      */
110     public void setCharset(String charset) {
111         this.charset = charset;
112     }
113     
114     /**
115      * @return the value of the string.
116      */
117     public String getValue() {
118         return value;
119     }
120     
121     /**
122      * @param value
123      *          the value of the string.
124      */
125     public void setValue(String value) {
126         this.value = value;
127     }
128 
129 
130 }