jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java
author aefimov
Thu, 16 Feb 2017 13:14:39 +0300
changeset 43852 93a527059d8a
parent 38822 8cc53e29c1d9
permissions -rw-r--r--
8174735: Update JAX-WS RI integration to latest version Reviewed-by: alanb, mchung, lancea Contributed-by: roman.grigoriadi@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     1
/*
43852
93a527059d8a 8174735: Update JAX-WS RI integration to latest version
aefimov
parents: 38822
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     4
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    10
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    15
 * accompanied this code).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    16
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    20
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    23
 * questions.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    24
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    25
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    26
package com.sun.istack.internal.localization;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    27
38822
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    28
import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier;
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    29
16791
fe5141eabb0e 8010393: Update JAX-WS RI to 2.2.9-b12941
alanb
parents: 12009
diff changeset
    30
import java.util.Arrays;
38822
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    31
import java.util.Locale;
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    32
import java.util.ResourceBundle;
16791
fe5141eabb0e 8010393: Update JAX-WS RI to 2.2.9-b12941
alanb
parents: 12009
diff changeset
    33
43852
93a527059d8a 8174735: Update JAX-WS RI integration to latest version
aefimov
parents: 38822
diff changeset
    34
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    35
/**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    36
 * @author WS Development Team
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    37
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    38
public final class LocalizableMessage implements Localizable {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    39
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    40
    private final String _bundlename;
38822
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    41
    private final ResourceBundleSupplier _rbSupplier;
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    42
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    43
    private final String _key;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    44
    private final Object[] _args;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    45
43852
93a527059d8a 8174735: Update JAX-WS RI integration to latest version
aefimov
parents: 38822
diff changeset
    46
    @Deprecated
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    47
    public LocalizableMessage(String bundlename, String key, Object... args) {
43852
93a527059d8a 8174735: Update JAX-WS RI integration to latest version
aefimov
parents: 38822
diff changeset
    48
        this(bundlename, null, key, args);
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    49
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    50
38822
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    51
    public LocalizableMessage(String bundlename, ResourceBundleSupplier rbSupplier,
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    52
                              String key, Object... args) {
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    53
        _bundlename = bundlename;
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    54
        _rbSupplier = rbSupplier;
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    55
        _key = key;
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    56
        if(args==null)
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    57
            args = new Object[0];
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    58
        _args = args;
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    59
    }
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    60
43852
93a527059d8a 8174735: Update JAX-WS RI integration to latest version
aefimov
parents: 38822
diff changeset
    61
    @Override
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    62
    public String getKey() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    63
        return _key;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    64
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    65
43852
93a527059d8a 8174735: Update JAX-WS RI integration to latest version
aefimov
parents: 38822
diff changeset
    66
    @Override
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    67
    public Object[] getArguments() {
16791
fe5141eabb0e 8010393: Update JAX-WS RI to 2.2.9-b12941
alanb
parents: 12009
diff changeset
    68
        return Arrays.copyOf(_args, _args.length);
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    69
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    70
43852
93a527059d8a 8174735: Update JAX-WS RI integration to latest version
aefimov
parents: 38822
diff changeset
    71
    @Override
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    72
    public String getResourceBundleName() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    73
        return _bundlename;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    74
    }
38822
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    75
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    76
    @Override
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    77
    public ResourceBundle getResourceBundle(Locale locale) {
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    78
        if (_rbSupplier == null)
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    79
            return null;
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    80
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    81
        return _rbSupplier.getResourceBundle(locale);
8cc53e29c1d9 8153944: wsimport and wsgen usage messages not printed
mchung
parents: 25871
diff changeset
    82
    }
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    83
}