1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.util.spi;
27
28 import java.util.ResourceBundle;
29
30 /**
31 * An interface for service providers that provide implementations of {@link
32 * java.util.ResourceBundle.Control}. The <a
33 * href="../ResourceBundle.html#default_behavior">default resource bundle loading
34 * behavior</a> of the {@code ResourceBundle.getBundle} factory methods that take
35 * no {@link java.util.ResourceBundle.Control} instance can be modified with {@code
36 * ResourceBundleControlProvider} implementations.
37 *
38 * @author Masayoshi Okutsu
39 * @since 1.8
40 * @see ResourceBundle#getBundle(String, java.util.Locale, ClassLoader, ResourceBundle.Control)
41 * ResourceBundle.getBundle
42 * @see java.util.ServiceLoader#loadInstalled(Class)
43 * @deprecated There is no longer any mechanism to install a custom
44 * {@code ResourceBundleControlProvider} implementation defined
45 * by the platform class loader or its ancestor. The recommended
46 * way to use a custom {@code Control} implementation to load resource bundle
47 * is to use {@link java.util.ResourceBundle#getBundle(String, Control)}
48 * or other factory methods that take custom {@link java.util.ResourceBundle.Control}.
49 */
50 @Deprecated(since="9", forRemoval=true)
51 public interface ResourceBundleControlProvider {
52 /**
53 * Returns a {@code ResourceBundle.Control} instance that is used
54 * to handle resource bundle loading for the given {@code
55 * baseName}. This method must return {@code null} if the given
56 * {@code baseName} isn't handled by this provider.
57 *
58 * @param baseName the base name of the resource bundle
59 * @return a {@code ResourceBundle.Control} instance,
60 * or {@code null} if the given {@code baseName} is not
61 * applicable to this provider.
62 * @throws NullPointerException if {@code baseName} is {@code null}
63 */
64 public ResourceBundle.Control getControl(String baseName);
65 }
|
1 /*
2 * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.util.spi;
27
28 import java.util.ResourceBundle;
29
30 /**
31 * An interface for service providers that provide implementations of {@link
32 * java.util.ResourceBundle.Control}. The <a
33 * href="../ResourceBundle.html#default_behavior">default resource bundle loading
34 * behavior</a> of the {@code ResourceBundle.getBundle} factory methods that take
35 * no {@link java.util.ResourceBundle.Control} instance can be modified with {@code
36 * ResourceBundleControlProvider} implementations.
37 *
38 * <p>Provider implementations are loaded from the application's class path
39 * using {@link java.util.ServiceLoader} at the first invocation of the
40 * {@code ResourceBundle.getBundle} factory method that takes no
41 * {@link java.util.ResourceBundle.Control} instance.
42 *
43 * <p>All {@code ResourceBundleControlProvider}s are ignored in named modules.
44 *
45 * @author Masayoshi Okutsu
46 * @since 1.8
47 * @see ResourceBundle#getBundle(String, java.util.Locale, ClassLoader, ResourceBundle.Control)
48 * ResourceBundle.getBundle
49 * @see java.util.ServiceLoader#load(Class)
50 */
51 public interface ResourceBundleControlProvider {
52 /**
53 * Returns a {@code ResourceBundle.Control} instance that is used
54 * to handle resource bundle loading for the given {@code
55 * baseName}. This method must return {@code null} if the given
56 * {@code baseName} isn't handled by this provider.
57 *
58 * @param baseName the base name of the resource bundle
59 * @return a {@code ResourceBundle.Control} instance,
60 * or {@code null} if the given {@code baseName} is not
61 * applicable to this provider.
62 * @throws NullPointerException if {@code baseName} is {@code null}
63 */
64 public ResourceBundle.Control getControl(String baseName);
65 }
|