jimm.twice.ice
Class Codes

java.lang.Object
  extended byjimm.twice.ice.Codes

public class Codes
extends java.lang.Object

This class finds the ICE error code short phrase for a particular error code number. It also contains a method for changing the locale (language).

Each language should have a file called codes_XX_YY.properties, where XX is the language code (e.g., "en" for English, "fr" for French) and YY is the country code (e.g., "US", "FR").

Author:
Jim Menard, jimm@io.com

Field Summary
protected  java.util.ResourceBundle codes
           
protected  java.util.Locale locale
           
protected static java.lang.String RESOURCE_FILE_PREFIX
           
 
Constructor Summary
protected Codes()
          Cosntructor.
 
Method Summary
 java.util.Locale getLocale()
          Returns the current locale.
static Codes instance()
          Returns the single instance of Codes.
 java.lang.String phraseFor(int code)
          Returns the string corresponding to the specified error code number, or null if there isn't one.
 void setLocale(java.util.Locale locale)
          Given a locale, start using the code short phrases for that lanuage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_FILE_PREFIX

protected static final java.lang.String RESOURCE_FILE_PREFIX
See Also:
Constant Field Values

locale

protected java.util.Locale locale

codes

protected java.util.ResourceBundle codes
Constructor Detail

Codes

protected Codes()
Cosntructor. Sets the locale to the local default.

Method Detail

instance

public static Codes instance()
Returns the single instance of Codes.

Returns:
the singleton instance of Codes

setLocale

public void setLocale(java.util.Locale locale)
Given a locale, start using the code short phrases for that lanuage.


getLocale

public java.util.Locale getLocale()
Returns the current locale.


phraseFor

public java.lang.String phraseFor(int code)
Returns the string corresponding to the specified error code number, or null if there isn't one.

Returns:
the string corresponding to the specified error code number, or null if there isn't one