Lines Matching refs:language

17  * See the License for the specific language governing permissions and
55 private String language;
113 * The default subject of a message is the subject that corresponds to the message's language.
114 * (see {@link #getLanguage()}) or if no language is set to the applications default
115 * language (see {@link Packet#getDefaultLanguage()}).
124 * Returns the subject corresponding to the language. If the language is null, the method result
125 * will be the same as {@link #getSubject()}. Null will be returned if the language does not have
128 * @param language the language of the subject to return.
129 * @return the subject related to the passed in language.
131 public String getSubject(String language) {
132 Subject subject = getMessageSubject(language);
136 private Subject getMessageSubject(String language) {
137 language = determineLanguage(language);
139 if (language.equals(subject.language)) {
171 * Adds a subject with a corresponding language.
173 * @param language the language of the subject being added.
178 public Subject addSubject(String language, String subject) {
179 language = determineLanguage(language);
180 Subject messageSubject = new Subject(language, subject);
186 * Removes the subject with the given language from the message.
188 * @param language the language of the subject which is to be removed
191 public boolean removeSubject(String language) {
192 language = determineLanguage(language);
194 if (language.equals(subject.language)) {
221 languages.add(subject.language);
231 * The default body of a message is the body that corresponds to the message's language.
232 * (see {@link #getLanguage()}) or if no language is set to the applications default
233 * language (see {@link Packet#getDefaultLanguage()}).
242 * Returns the body corresponding to the language. If the language is null, the method result
243 * will be the same as {@link #getBody()}. Null will be returned if the language does not have
246 * @param language the language of the body to return.
247 * @return the body related to the passed in language.
250 public String getBody(String language) {
251 Body body = getMessageBody(language);
255 private Body getMessageBody(String language) {
256 language = determineLanguage(language);
258 if (language.equals(body.language)) {
290 * Adds a body with a corresponding language.
292 * @param language the language of the body being added.
298 public Body addBody(String language, String body) {
299 language = determineLanguage(language);
300 Body messageBody = new Body(language, body);
306 * Removes the body with the given language from the message.
308 * @param language the language of the body which is to be removed
311 public boolean removeBody(String language) {
312 language = determineLanguage(language);
314 if (language.equals(body.language)) {
343 languages.add(body.language);
376 return language;
382 * @param language the xml:lang of this Message.
385 public void setLanguage(String language) {
386 this.language = language;
389 private String determineLanguage(String language) {
392 language = "".equals(language) ? null : language;
394 // if given language is null check if message language is set
395 if (language == null && this.language != null) {
396 return this.language;
398 else if (language == null) {
402 return language;
413 if (language != null) {
429 // Add the subject in the default language
436 // Skip the default language
439 buf.append("<subject xml:lang=\"").append(subject.language).append("\">");
443 // Add the body in the default language
450 // Skip the default language
484 if (language != null ? !language.equals(message.language) : message.language != null) {
502 result = 31 * result + (language != null ? language.hashCode() : 0);
508 * Represents a message subject, its language and the content of the subject.
513 private String language;
515 private Subject(String language, String subject) {
516 if (language == null) {
522 this.language = language;
527 * Returns the language of this message subject.
529 * @return the language of this message subject.
532 return language;
548 result = prime * result + this.language.hashCode();
564 // simplified comparison because language and subject are always set
565 return this.language.equals(other.language) && this.subject.equals(other.subject);
571 * Represents a message body, its language and the content of the message.
576 private String language;
578 private Body(String language, String message) {
579 if (language == null) {
585 this.language = language;
590 * Returns the language of this message body.
592 * @return the language of this message body.
595 return language;
610 result = prime * result + this.language.hashCode();
626 // simplified comparison because language and message are always set
627 return this.language.equals(other.language) && this.message.equals(other.message);