org.apache.xml.res
Class XMLMessages

java.lang.Object
  extended by org.apache.xml.res.XMLMessages
Direct Known Subclasses:
XPATHMessages

public class XMLMessages
extends java.lang.Object

A utility class for issuing XML error messages.


Field Summary
protected static java.lang.String BAD_CODE
          String to use if a bad message code is used.
protected  java.util.Locale fLocale
          The local object to use.
protected static java.lang.String FORMAT_FAILED
          String to use if the message format operation failed.
private static java.lang.String XML_ERROR_RESOURCES
          The class name of the XML error message string table.
private static java.util.ListResourceBundle XMLBundle
          The language specific resource object for XML messages.
 
Constructor Summary
XMLMessages()
           
 
Method Summary
static java.lang.String createMsg(java.util.ListResourceBundle fResourceBundle, java.lang.String msgKey, java.lang.Object[] args)
          Creates a message from the specified key and replacement arguments, localized to the given locale.
static java.lang.String createXMLMessage(java.lang.String msgKey, java.lang.Object[] args)
          Creates a message from the specified key and replacement arguments, localized to the given locale.
 java.util.Locale getLocale()
          Get the Locale object that is being used.
protected static java.lang.String getResourceSuffix(java.util.Locale locale)
          Return the resource file suffic for the indicated locale For most locales, this will be based the language code.
static java.util.ListResourceBundle loadResourceBundle(java.lang.String className)
          Return a named ResourceBundle for a particular locale.
 void setLocale(java.util.Locale locale)
          Set the Locale object to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLocale

protected java.util.Locale fLocale
The local object to use.


XMLBundle

private static java.util.ListResourceBundle XMLBundle
The language specific resource object for XML messages.


XML_ERROR_RESOURCES

private static final java.lang.String XML_ERROR_RESOURCES
The class name of the XML error message string table.

See Also:
Constant Field Values

BAD_CODE

protected static final java.lang.String BAD_CODE
String to use if a bad message code is used.

See Also:
Constant Field Values

FORMAT_FAILED

protected static final java.lang.String FORMAT_FAILED
String to use if the message format operation failed.

See Also:
Constant Field Values
Constructor Detail

XMLMessages

public XMLMessages()
Method Detail

setLocale

public void setLocale(java.util.Locale locale)
Set the Locale object to use.

Parameters:
locale - non-null reference to Locale object.

getLocale

public java.util.Locale getLocale()
Get the Locale object that is being used.

Returns:
non-null reference to Locale object.

createXMLMessage

public static final java.lang.String createXMLMessage(java.lang.String msgKey,
                                                      java.lang.Object[] args)
Creates a message from the specified key and replacement arguments, localized to the given locale.

Parameters:
msgKey - The key for the message text.
args - The arguments to be used as replacement text in the message created.
Returns:
The formatted message string.

createMsg

public static final java.lang.String createMsg(java.util.ListResourceBundle fResourceBundle,
                                               java.lang.String msgKey,
                                               java.lang.Object[] args)
Creates a message from the specified key and replacement arguments, localized to the given locale.

Parameters:
fResourceBundle - The resource bundle to use.
msgKey - The message key to use.
args - The arguments to be used as replacement text in the message created.
Returns:
The formatted message string.

loadResourceBundle

public static java.util.ListResourceBundle loadResourceBundle(java.lang.String className)
                                                       throws java.util.MissingResourceException
Return a named ResourceBundle for a particular locale. This method mimics the behavior of ResourceBundle.getBundle().

Parameters:
className - The class name of the resource bundle.
Returns:
the ResourceBundle
Throws:
java.util.MissingResourceException

getResourceSuffix

protected static java.lang.String getResourceSuffix(java.util.Locale locale)
Return the resource file suffic for the indicated locale For most locales, this will be based the language code. However for Chinese, we do distinguish between Taiwan and PRC

Parameters:
locale - the locale
Returns:
an String suffix which can be appended to a resource name