64 * protected String toBundleName(String baseName, Locale locale) {
65 * // return the bundle name per the naming of the resource bundle
66 * :
67 * }
68 *
69 * public ResourceBundle getBundle(String baseName, Locale locale) {
70 * // this module only provides bundles in french
71 * if (locale.equals(Locale.FRENCH)) {
72 * return super.getBundle(baseName, locale);
73 * }
74 * return null;
75 * }
76 * }</code></pre>
77 *
78 * @see <a href="../ResourceBundle.html#bundleprovider">
79 * Resource Bundles in Named Modules</a>
80 * @see <a href="../ResourceBundle.html#RBP_support">
81 * ResourceBundleProvider Service Providers</a>
82 *
83 * @since 9
84 */
85 public abstract class AbstractResourceBundleProvider implements ResourceBundleProvider {
86 private static final JavaUtilResourceBundleAccess RB_ACCESS =
87 SharedSecrets.getJavaUtilResourceBundleAccess();
88
89 private static final String FORMAT_CLASS = "java.class";
90 private static final String FORMAT_PROPERTIES = "java.properties";
91
92 private final String[] formats;
93
94 /**
95 * Constructs an {@code AbstractResourceBundleProvider} with the
96 * "java.properties" format. This constructor is equivalent to
97 * {@code AbstractResourceBundleProvider("java.properties")}.
98 */
99 protected AbstractResourceBundleProvider() {
100 this(FORMAT_PROPERTIES);
101 }
102
103 /**
|
64 * protected String toBundleName(String baseName, Locale locale) {
65 * // return the bundle name per the naming of the resource bundle
66 * :
67 * }
68 *
69 * public ResourceBundle getBundle(String baseName, Locale locale) {
70 * // this module only provides bundles in french
71 * if (locale.equals(Locale.FRENCH)) {
72 * return super.getBundle(baseName, locale);
73 * }
74 * return null;
75 * }
76 * }</code></pre>
77 *
78 * @see <a href="../ResourceBundle.html#bundleprovider">
79 * Resource Bundles in Named Modules</a>
80 * @see <a href="../ResourceBundle.html#RBP_support">
81 * ResourceBundleProvider Service Providers</a>
82 *
83 * @since 9
84 * @spec JPMS
85 */
86 public abstract class AbstractResourceBundleProvider implements ResourceBundleProvider {
87 private static final JavaUtilResourceBundleAccess RB_ACCESS =
88 SharedSecrets.getJavaUtilResourceBundleAccess();
89
90 private static final String FORMAT_CLASS = "java.class";
91 private static final String FORMAT_PROPERTIES = "java.properties";
92
93 private final String[] formats;
94
95 /**
96 * Constructs an {@code AbstractResourceBundleProvider} with the
97 * "java.properties" format. This constructor is equivalent to
98 * {@code AbstractResourceBundleProvider("java.properties")}.
99 */
100 protected AbstractResourceBundleProvider() {
101 this(FORMAT_PROPERTIES);
102 }
103
104 /**
|