01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.axis2.jaxws.message;
20:
21: import java.util.Locale;
22:
23: /** Agnostic representation of a Fault Reason/faultstring. See @XMLFault */
24: public class XMLFaultReason {
25: String text;
26: String lang;
27:
28: /**
29: * A Fault Reason has the reason text and language
30: *
31: * @param text
32: * @param lang
33: */
34: public XMLFaultReason(String text, String lang) {
35: this .text = text;
36: this .lang = lang;
37: }
38:
39: /**
40: * A Fault Reason with the default language
41: *
42: * @param text
43: */
44: public XMLFaultReason(String text) {
45: this (text, getDefaultLang());
46: }
47:
48: /** @return Returns the lang. */
49: public String getLang() {
50: return lang;
51: }
52:
53: /** @return Returns the text. */
54: public String getText() {
55: return text;
56: }
57:
58: /** @return the IS0 639 language identifier for the default locale */
59: public static String getDefaultLang() {
60: Locale locale = Locale.getDefault();
61: // The spec indicates to use RFC 3066, which uses the values defined by ISO 639,
62: // which is what getLanguage() returns.
63: return locale.getLanguage();
64: }
65:
66: }
|