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
26package java.util.spi;
27
28import 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 * @revised 9
48 * @spec JPMS
49 * @see ResourceBundle#getBundle(String, java.util.Locale, ClassLoader, ResourceBundle.Control)
50 *      ResourceBundle.getBundle
51 * @see java.util.ServiceLoader#load(Class)
52 */
53public interface ResourceBundleControlProvider {
54    /**
55     * Returns a {@code ResourceBundle.Control} instance that is used
56     * to handle resource bundle loading for the given {@code
57     * baseName}. This method must return {@code null} if the given
58     * {@code baseName} isn't handled by this provider.
59     *
60     * @param baseName the base name of the resource bundle
61     * @return a {@code ResourceBundle.Control} instance,
62     *         or {@code null} if the given {@code baseName} is not
63     *         applicable to this provider.
64     * @throws NullPointerException if {@code baseName} is {@code null}
65     */
66    public ResourceBundle.Control getControl(String baseName);
67}
68