Extension SDK 10.1.2

oracle.ide.util
Class ArrayResourceBundle

java.lang.Object
  extended byjava.util.ResourceBundle
      extended byoracle.ide.util.ArrayResourceBundle

public abstract class ArrayResourceBundle
extends java.util.ResourceBundle

ArrayResourceBundle is an abstract subclass of ResourceBundle that manages locale-dependent resources in an array. By using numeric references rather than string references, it requires less overhead and provides better performance than ListResourceBundle and PropertyResourceBundle. See ResourceBundle for more information about resource bundles in general.

Subclasses must override getContents and provide an array, where each item in the array is the resource value. The key for each resource value is its numeric offset in the array. For example, the first element in the array has the key 0. It may be retrieved by using either getObject(0) or getObject("0");

Unlike ListResourceBundle and PropertyResourceBundle, where each locale-specific variation of a bundle can override only selected resources, with ArrayResourceBundle, each variation must provide the complete set of Resources. For example,if MyResources has three resources, then MyResources_ja and MyResources_fr must also have three resources.

The following example shows the structure of a ResourceBundle based on ArrayResourceBundle.

 class MyResources extends ArrayResourceBundle {
   private static final Object[] contents = {
   // LOCALIZE THIS
     "Yes",    // Label for the YES button
     "No",     // Label for the NO button
     "Cancel"  // Label for the CANCEL button
   // END OF MATERIAL TO LOCALIZE
   };
   protected Object[] getContents() {
     return contents;
   }
 }
 

See Also:
ResourceBundle

Field Summary
 
Fields inherited from class java.util.ResourceBundle
parent
 
Constructor Summary
ArrayResourceBundle()
           
 
Method Summary
 java.lang.String formatImpl(int key, java.lang.Object param1)
          Fetch a formatted String resource from the ArrayResourceBundle.
 java.lang.String formatImpl(int key, java.lang.Object[] params)
          Fetch a formatted String resource from the ArrayResourceBundle.
 java.lang.String formatImpl(int key, java.lang.Object param1, java.lang.Object param2)
          Fetch a formatted String resource from the ArrayResourceBundle.
 java.lang.String formatImpl(int key, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
          Fetch a formatted String resource from the ArrayResourceBundle.
 javax.swing.KeyStroke getAcceleratorImpl(int key)
          Fetch a keystroke from the ArrayResourceBundle.
 char getCharImpl(int key)
          Fetch a char from the ArrayResourceBundle.
protected abstract  java.lang.Object[] getContents()
          Fetch the contents of this resource bundle.
 java.awt.Font getFontImpl(int key)
          Fetch a font from the ArrayResourceBundle.
 javax.swing.Icon getIconImpl(int key)
          Fetch an icon from the ArrayResourceBundle.
protected  javax.swing.ImageIcon getImageIconImpl(int key, boolean shouldCacheIcon)
          Fetch an ImageIcon based on a file name from the ArrayResourceBundle.
 java.awt.Image getImageImpl(int key)
          Fetch an image from the ArrayResourceBundle.
 java.lang.Integer getIntegerImpl(int key)
          Fetch an integer from the ArrayResourceBundle.
 java.util.Enumeration getKeys()
          Returns an enumeration of the keys.
 char getMnemonicImpl(int key)
          Fetch a mnemonic from the ArrayResourceBundle.
 java.lang.Object getObject(int key)
          Deprecated.  
 java.lang.Object getObjectImpl(int key)
          Get an object from an ArrayResourceBundle.
 java.lang.String[] getStringArray(int key)
          Deprecated.  
 java.lang.String getStringImpl(int key)
          Fetch a String from the ArrayResourceBundle.
 javax.swing.Icon getUncachedIconImpl(int key)
          Fetch an icon from the ArrayResourceBundle that will not be cached.
 java.awt.Image getUncachedImageImpl(int key)
          Fetch an image from the ArrayResourceBundle that will not be cached.
protected  java.lang.Object handleGetObject(java.lang.String key)
          Gets an object for the given key from this resource bundle.
 
Methods inherited from class java.util.ResourceBundle
getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayResourceBundle

public ArrayResourceBundle()
Method Detail

getStringArray

public final java.lang.String[] getStringArray(int key)
Deprecated.  

Get an object from an ArrayResourceBundle.
Convenience method to save casting.

Parameters:
key - see class description.

getObject

public final java.lang.Object getObject(int key)
Deprecated.  

Get an object from an ArrayResourceBundle.

Parameters:
key - see class description.

getStringImpl

public final java.lang.String getStringImpl(int key)
Fetch a String from the ArrayResourceBundle. This is for convenience to save casting.

Parameters:
key - index into the resource array
Returns:
the String resource

getCharImpl

public final char getCharImpl(int key)
Fetch a char from the ArrayResourceBundle.

Parameters:
key - index into the resource array
Returns:
the char resource

getFontImpl

public final java.awt.Font getFontImpl(int key)
Fetch a font from the ArrayResourceBundle.

Parameters:
key - index into the resource array
Returns:
the font resource

getAcceleratorImpl

public final javax.swing.KeyStroke getAcceleratorImpl(int key)
Fetch a keystroke from the ArrayResourceBundle.

Parameters:
key - index into the resource array
Returns:
the keystroke resource

getIntegerImpl

public final java.lang.Integer getIntegerImpl(int key)
Fetch an integer from the ArrayResourceBundle.

Parameters:
key - index into the resource array
Returns:
the integer resource

getMnemonicImpl

public final char getMnemonicImpl(int key)
Fetch a mnemonic from the ArrayResourceBundle.

Parameters:
key - index into the resource array
Returns:
the mnemonic resource

getIconImpl

public final javax.swing.Icon getIconImpl(int key)
Fetch an icon from the ArrayResourceBundle.

Parameters:
key - index into the resource array
Returns:
the icon resource

getUncachedIconImpl

public final javax.swing.Icon getUncachedIconImpl(int key)
Fetch an icon from the ArrayResourceBundle that will not be cached.

Parameters:
key - index into the resource array
Returns:
the icon resource

getImageImpl

public final java.awt.Image getImageImpl(int key)
Fetch an image from the ArrayResourceBundle.

Parameters:
key - index into the resource array
Returns:
the image resource

getUncachedImageImpl

public final java.awt.Image getUncachedImageImpl(int key)
Fetch an image from the ArrayResourceBundle that will not be cached.

Parameters:
key - index into the resource array
Returns:
the image resource

getObjectImpl

public final java.lang.Object getObjectImpl(int key)
Get an object from an ArrayResourceBundle.

Parameters:
key - index into the resource array
Returns:
the object from the resource bundle

formatImpl

public final java.lang.String formatImpl(int key,
                                         java.lang.Object[] params)
Fetch a formatted String resource from the ArrayResourceBundle. This will substitute "{n}" occurrences in the string resource with the appropriate parameter "n" from the array.

Parameters:
key - index into the resource array
params - the array of parameters.
Returns:
the formatted String resource

formatImpl

public final java.lang.String formatImpl(int key,
                                         java.lang.Object param1)
Fetch a formatted String resource from the ArrayResourceBundle.

Parameters:
key - index into the resource array
param1 - the subsitution value for {0}
Returns:
the formatted String resource

formatImpl

public final java.lang.String formatImpl(int key,
                                         java.lang.Object param1,
                                         java.lang.Object param2)
Fetch a formatted String resource from the ArrayResourceBundle.

Parameters:
key - index into the resource array
param1 - the subsitution value for {0}
param2 - the subsitution value for {1}
Returns:
the formatted String resource

formatImpl

public final java.lang.String formatImpl(int key,
                                         java.lang.Object param1,
                                         java.lang.Object param2,
                                         java.lang.Object param3)
Fetch a formatted String resource from the ArrayResourceBundle.

Parameters:
key - index into the resource array
param1 - the subsitution value for {0}
param2 - the subsitution value for {1}
param3 - the subsitution value for {2}
Returns:
the formatted String resource

getImageIconImpl

protected final javax.swing.ImageIcon getImageIconImpl(int key,
                                                       boolean shouldCacheIcon)
Fetch an ImageIcon based on a file name from the ArrayResourceBundle.

Parameters:
key - index into the resource array
shouldCacheIcon - true to cache the icon once it has been loaded
Returns:
the image icon resource

getContents

protected abstract java.lang.Object[] getContents()
Fetch the contents of this resource bundle. This is overridden by generated sub-classes to return their resources.

Returns:
the resources of the bundle as an array

getKeys

public final java.util.Enumeration getKeys()
Returns an enumeration of the keys.


handleGetObject

protected final java.lang.Object handleGetObject(java.lang.String key)
Gets an object for the given key from this resource bundle. Returns null if this resource bundle does not contain an object for the given key.

Parameters:
key - the key for the desired object
Returns:
the object for the given key, or null

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.