src/share/classes/java/util/ResourceBundle.java

Print this page
rev 10048 : 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
Reviewed-by:


 265  *         if (key.equals("cancelKey")) return "Abbrechen";
 266  *         return null;
 267  *     }
 268  *
 269  *     protected Set<String> handleKeySet() {
 270  *         return new HashSet<String>(Arrays.asList("cancelKey"));
 271  *     }
 272  * }
 273  * </pre>
 274  * </blockquote>
 275  * You do not have to restrict yourself to using a single family of
 276  * <code>ResourceBundle</code>s. For example, you could have a set of bundles for
 277  * exception messages, <code>ExceptionResources</code>
 278  * (<code>ExceptionResources_fr</code>, <code>ExceptionResources_de</code>, ...),
 279  * and one for widgets, <code>WidgetResource</code> (<code>WidgetResources_fr</code>,
 280  * <code>WidgetResources_de</code>, ...); breaking up the resources however you like.
 281  *
 282  * @see ListResourceBundle
 283  * @see PropertyResourceBundle
 284  * @see MissingResourceException
 285  * @since JDK1.1
 286  */
 287 public abstract class ResourceBundle {
 288 
 289     /** initial size of the bundle cache */
 290     private static final int INITIAL_CACHE_SIZE = 32;
 291 
 292     /** constant indicating that no resource bundle exists */
 293     private static final ResourceBundle NONEXISTENT_BUNDLE = new ResourceBundle() {
 294             public Enumeration<String> getKeys() { return null; }
 295             protected Object handleGetObject(String key) { return null; }
 296             public String toString() { return "NONEXISTENT_BUNDLE"; }
 297         };
 298 
 299 
 300     /**
 301      * The cache is a map from cache keys (with bundle base name, locale, and
 302      * class loader) to either a resource bundle or NONEXISTENT_BUNDLE wrapped by a
 303      * BundleReference.
 304      *
 305      * The cache is a ConcurrentMap, allowing the cache to be searched




 265  *         if (key.equals("cancelKey")) return "Abbrechen";
 266  *         return null;
 267  *     }
 268  *
 269  *     protected Set&lt;String&gt; handleKeySet() {
 270  *         return new HashSet&lt;String&gt;(Arrays.asList("cancelKey"));
 271  *     }
 272  * }
 273  * </pre>
 274  * </blockquote>
 275  * You do not have to restrict yourself to using a single family of
 276  * <code>ResourceBundle</code>s. For example, you could have a set of bundles for
 277  * exception messages, <code>ExceptionResources</code>
 278  * (<code>ExceptionResources_fr</code>, <code>ExceptionResources_de</code>, ...),
 279  * and one for widgets, <code>WidgetResource</code> (<code>WidgetResources_fr</code>,
 280  * <code>WidgetResources_de</code>, ...); breaking up the resources however you like.
 281  *
 282  * @see ListResourceBundle
 283  * @see PropertyResourceBundle
 284  * @see MissingResourceException
 285  * @since 1.1
 286  */
 287 public abstract class ResourceBundle {
 288 
 289     /** initial size of the bundle cache */
 290     private static final int INITIAL_CACHE_SIZE = 32;
 291 
 292     /** constant indicating that no resource bundle exists */
 293     private static final ResourceBundle NONEXISTENT_BUNDLE = new ResourceBundle() {
 294             public Enumeration<String> getKeys() { return null; }
 295             protected Object handleGetObject(String key) { return null; }
 296             public String toString() { return "NONEXISTENT_BUNDLE"; }
 297         };
 298 
 299 
 300     /**
 301      * The cache is a map from cache keys (with bundle base name, locale, and
 302      * class loader) to either a resource bundle or NONEXISTENT_BUNDLE wrapped by a
 303      * BundleReference.
 304      *
 305      * The cache is a ConcurrentMap, allowing the cache to be searched