|
deegree 2.1 (2007/11/08 09:57 build-328-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.ResourceBundle
org.deegree.model.csct.resources.ResourceBundle
public class ResourceBundle
{link java.util.ResourceBundle} implementation using integers instead of strings for
resource keys. Because it doesn't use strings, this implementation avoid adding all
those string constants to .class
files and runtime images. Developpers
still have meaningful labels in their code (e.g. DIMENSION_MISMATCH
)
through a set of constants defined in interfaces. This approach furthermore give the
benefict of compile-time safety. Because integer constants are inlined right into
class files at compile time, the declarative interface is never loaded at run time.
This class also provides facilities for string formatting using MessageFormat
.
Field Summary | |
---|---|
protected String[] |
values
The array of resources. |
Fields inherited from class java.util.ResourceBundle |
---|
parent |
Constructor Summary | |
---|---|
protected |
ResourceBundle(String filename)
Construct a new resource bundle. |
Method Summary | |
---|---|
Enumeration<String> |
getKeys()
Returns an enumeration of the keys. |
String |
getLabel(int keyID)
Gets a string for the given key and append ": " to it. |
protected String |
getLoggerName()
Returns the name of the logger to use. |
String |
getMenuLabel(int keyID)
Gets a string for the given key and append "..." to it. |
String |
getString(int keyID)
Gets a string for the given key from this resource bundle or one of its parents. |
String |
getString(int keyID,
Object arg0)
Gets a string for the given key and format it with the specified argument. |
String |
getString(int keyID,
Object arg0,
Object arg1)
Gets a string for the given key are replace all occurence of "{0}", "{1}", with values of arg0 , arg1 , etc. |
String |
getString(int keyID,
Object arg0,
Object arg1,
Object arg2)
Gets a string for the given key are replace all occurence of "{0}", "{1}", with values of arg0 , arg1 , etc. |
String |
getString(int keyID,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Gets a string for the given key are replace all occurence of "{0}", "{1}", with values of arg0 , arg1 , etc. |
String |
getString(int keyID,
Object arg0,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
Gets a string for the given key are replace all occurence of "{0}", "{1}", with values of arg0 , arg1 , etc. |
protected Object |
handleGetObject(String key)
Gets an object for the given key from this resource bundle. |
void |
list(Writer out)
List resources to the specified stream. |
String |
toString()
Returns a string representation of this object. |
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, wait, wait, wait |
Field Detail |
---|
protected String[] values
values[14]
. This array will be loaded only when
first needed. We should not load it at construction time, because some
ResourceBundle
objects will never ask for values. This is
case especially for ancestor classes of Resources_fr_CA
,
Resources_en
, Resources_de
, etc., which will
be used only if a key has not been found in the subclasse.
Constructor Detail |
---|
protected ResourceBundle(String filename)
filename
- The resource name containing resources. It is
usually a filename, but may also be an entry in a JAR file.Method Detail |
---|
protected String getLoggerName()
public final void list(Writer out) throws IOException
out
- The destination stream.
IOException
- if an output operation failed.public final Enumeration<String> getKeys()
getKeys
in class ResourceBundle
protected final Object handleGetObject(String key)
handleGetObject
in class ResourceBundle
key
- the key for the desired object
NullPointerException
- if key
is null
public final String getMenuLabel(int keyID) throws MissingResourceException
keyID
- The key for the desired string.
MissingResourceException
- If no object for the given key can be found.public final String getLabel(int keyID) throws MissingResourceException
keyID
- The key for the desired string.
MissingResourceException
- If no object for the given key can be found.public final String getString(int keyID) throws MissingResourceException
keyID
- The key for the desired string.
MissingResourceException
- If no object for the given key can be found.public final String getString(int keyID, Object arg0) throws MissingResourceException
MessageFormat
. Calling his method is
approximatively equivalent to calling:
IfString pattern = getString(key); Format f = new MessageFormat(pattern); return f.format(arg0);
arg0
is not already an array, it will be wrapped into an array
of length 1. Using MessageFormat
, all occurence of "{0}", "{1}", "{2}"
in the resource string will be replaced by arg0[0]
, arg0[1]
,
arg0[2]
, etc.
keyID
- The key for the desired string.arg0
- A single object or an array of objects to be formatted and substituted.
MissingResourceException
- If no object for the given key can be found.MessageFormat
public final String getString(int keyID, Object arg0, Object arg1) throws MissingResourceException
arg0
, arg1
, etc.
keyID
- The key for the desired string.arg0
- Value to substitute to "{0}".arg1
- Value to substitute to "{1}".
MissingResourceException
- If no object for the given key can be found.public final String getString(int keyID, Object arg0, Object arg1, Object arg2) throws MissingResourceException
arg0
, arg1
, etc.
keyID
- The key for the desired string.arg0
- Value to substitute to "{0}".arg1
- Value to substitute to "{1}".arg2
- Value to substitute to "{2}".
MissingResourceException
- If no object for the given key can be found.public final String getString(int keyID, Object arg0, Object arg1, Object arg2, Object arg3) throws MissingResourceException
arg0
, arg1
, etc.
keyID
- The key for the desired string.arg0
- Value to substitute to "{0}".arg1
- Value to substitute to "{1}".arg2
- Value to substitute to "{2}".arg3
- Value to substitute to "{3}".
MissingResourceException
- If no object for the given key can be found.public final String getString(int keyID, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) throws MissingResourceException
arg0
, arg1
, etc.
keyID
- The key for the desired string.arg0
- Value to substitute to "{0}".arg1
- Value to substitute to "{1}".arg2
- Value to substitute to "{2}".arg3
- Value to substitute to "{3}".arg4
- Value to substitute to "{4}".
MissingResourceException
- If no object for the given key can be found.public String toString()
toString
in class Object
|
deegree 2.1 (2007/11/08 09:57 build-328-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://deegree.sourceforge.net