com.waveset.msgcat
Class Catalog

java.lang.Object
  extended bycom.waveset.msgcat.Catalog

public class Catalog
extends java.lang.Object

An object that encapsulates access to locale specifc message catalogs for Waveset messages.

Do we want to throw excpetions here or just return an English message describing the error?


Field Summary
static char CATALOG_DELIM
           
static java.lang.String code_id
           
static char END_DELIM
           
static char START_DELIM
           
 
Method Summary
static java.lang.String format(java.util.Locale locale, java.lang.String id)
           
static java.lang.String format(java.util.Locale locale, java.lang.String id, java.lang.Object[] parameters)
           
static java.lang.String format(java.util.Locale locale, java.lang.String key, java.lang.Object[] parameters, java.lang.String defVal)
           
static java.lang.String format(java.lang.String id, java.util.Locale locale)
           
static Catalog getCatalog()
          Public factory method get the singleton Catalog object.
static CustomCatalogSet getCustomCatalogSet()
          Retrieve this catalog's custom catalog set.
 java.lang.String getMessage(java.util.Locale locale, java.lang.String id)
          Deprecated. - Use format(locale, id, null);
 java.lang.String getMessage(java.util.Locale locale, java.lang.String id, java.lang.Object[] parameters)
          Deprecated. - Use format(locale, id, parameters);
 java.lang.String getMessage(java.lang.String id, java.util.Locale locale)
          Deprecated. - Use format(locale, id, null);
 java.lang.String getMessage(java.lang.String id, java.lang.Object[] parameters)
          Deprecated. - Use format(locale, id, parameters);
 java.lang.String getMessage(java.lang.String id, java.lang.Object[] parameters, java.util.Locale locale)
          Deprecated. - Use format(locale, id, parameters);
protected static java.text.MessageFormat getMessageFormat(java.lang.String pattern, java.util.Locale locale)
          Gets the MessageFormat class the fits the pattern and locale passed.
static boolean isSupported(java.util.Locale locale)
           
static java.lang.String replaceEmbeddedKeys(java.lang.String msg, java.util.Locale locale)
          Parse a string looking for pattern [key].
 boolean supportable(java.util.Locale locale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

START_DELIM

public static final char START_DELIM
See Also:
Constant Field Values

END_DELIM

public static final char END_DELIM
See Also:
Constant Field Values

CATALOG_DELIM

public static final char CATALOG_DELIM
See Also:
Constant Field Values
Method Detail

getCatalog

public static Catalog getCatalog()
Public factory method get the singleton Catalog object.


isSupported

public static boolean isSupported(java.util.Locale locale)
Returns:
whether a message catalog is available for the given locale.

supportable

public boolean supportable(java.util.Locale locale)

format

public static java.lang.String format(java.util.Locale locale,
                                      java.lang.String id)
Returns:
a message formatted according to the specified locale if the id is found; otherwise return null.

format

public static java.lang.String format(java.lang.String id,
                                      java.util.Locale locale)
Returns:
a message formatted according to the specified locale if the id is found; otherwise return null.

format

public static java.lang.String format(java.util.Locale locale,
                                      java.lang.String id,
                                      java.lang.Object[] parameters)
Returns:
a message formatted according to the specified locale if the id is found; otherwise return null.

format

public static java.lang.String format(java.util.Locale locale,
                                      java.lang.String key,
                                      java.lang.Object[] parameters,
                                      java.lang.String defVal)
Returns:
a message formatted according to the specified locale if the id is found; otherwise return the specified default.

replaceEmbeddedKeys

public static java.lang.String replaceEmbeddedKeys(java.lang.String msg,
                                                   java.util.Locale locale)
Parse a string looking for pattern [key]. If the pattern is found, lookup key in the catalog. If found, replace [key] with the catalog entry. The will be called recursively for the key resolution.

Parameters:
msg - A String which may have the pattern [key]
locale - The current locale
Returns:
A String with patterns matching [key] replaced with the key's value from the message catalog

getMessage

public java.lang.String getMessage(java.util.Locale locale,
                                   java.lang.String id)
Deprecated. - Use format(locale, id, null);

Deprecated method supported by the obsolete MessageCatalog class


getMessage

public java.lang.String getMessage(java.util.Locale locale,
                                   java.lang.String id,
                                   java.lang.Object[] parameters)
Deprecated. - Use format(locale, id, parameters);

Deprecated method supported by the obsolete MessageCatalog class


getMessage

public java.lang.String getMessage(java.lang.String id,
                                   java.lang.Object[] parameters)
Deprecated. - Use format(locale, id, parameters);

Deprecated method supported by the obsolete MessageCatalog class


getMessage

public java.lang.String getMessage(java.lang.String id,
                                   java.util.Locale locale)
Deprecated. - Use format(locale, id, null);

Deprecated method supported by the obsolete MessageCatalog class


getMessage

public java.lang.String getMessage(java.lang.String id,
                                   java.lang.Object[] parameters,
                                   java.util.Locale locale)
Deprecated. - Use format(locale, id, parameters);

Deprecated method supported by the obsolete MessageCatalog class


getMessageFormat

protected static java.text.MessageFormat getMessageFormat(java.lang.String pattern,
                                                          java.util.Locale locale)
Gets the MessageFormat class the fits the pattern and locale passed.

Parameters:
pattern - Pattern used to format a message.
locale - Locale used to format the message.
Returns:
Returns a message format that fits the pattern and locale.

getCustomCatalogSet

public static CustomCatalogSet getCustomCatalogSet()
Retrieve this catalog's custom catalog set.

Returns:
This catalog's custom catalog set.