org.castor.core.util
Class Messages

java.lang.Object
  extended by org.castor.core.util.Messages

public final class Messages
extends java.lang.Object

I18N message formatting class. A static factory for obtaining messages and formatting messages with arguments.

The resource file org.exolab.castor.util.resources.messages contains a list of all the messages in English. Additional resource files can be added for other languages and locales by placing them in the same package with a language/locale prefix. See the I18N documentation and use of resource bundles in the JDK docs.

Since:
1.0.1
Version:
$Revision: 6907 $ $Date: 2006-04-10 16:39:24 -0600 (Mon, 10 Apr 2006) $
Author:
Assaf Arkin, Ralf Joachim

Field Summary
static java.lang.String RESOURCE_NAME
          The name of the resource holding all the messages in the English language.
 
Method Summary
static java.lang.String format(java.lang.String message, java.lang.Object arg1)
          Format the named message using a single argument and return the full message text.
static java.lang.String format(java.lang.String message, java.lang.Object[] args)
          Format the named message using any number of arguments and return the full message text.
static java.lang.String format(java.lang.String message, java.lang.Object arg1, java.lang.Object arg2)
          Format the named message using two argument and return the full message text.
static java.lang.String format(java.lang.String message, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Format the named message using three argument and return the full message text.
static java.lang.String message(java.lang.String message)
          Return the text of the named message without formatting.
static void setDefaultLocale()
          Set the default locale to use for loading messages.
static void setLocale(java.util.Locale locale)
          Set the locale to use for loading messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_NAME

public static final java.lang.String RESOURCE_NAME
The name of the resource holding all the messages in the English language. Resources for other languages and locales use the same name with a language/locale prefix.

See Also:
Constant Field Values
Method Detail

setDefaultLocale

public static void setDefaultLocale()
Set the default locale to use for loading messages. Calling this method will reload all the messages based on the new locale name.


setLocale

public static void setLocale(java.util.Locale locale)
Set the locale to use for loading messages. Calling this method will reload all the messages based on the new locale name.

Parameters:
locale - the locale for which a resource bundle is desired.

format

public static java.lang.String format(java.lang.String message,
                                      java.lang.Object arg1)
Format the named message using a single argument and return the full message text.

Parameters:
message - The message name
arg1 - The first argument
Returns:
The full message text

format

public static java.lang.String format(java.lang.String message,
                                      java.lang.Object arg1,
                                      java.lang.Object arg2)
Format the named message using two argument and return the full message text.

Parameters:
message - The message name
arg1 - The first argument
arg2 - The second argument
Returns:
The full message text

format

public static java.lang.String format(java.lang.String message,
                                      java.lang.Object arg1,
                                      java.lang.Object arg2,
                                      java.lang.Object arg3)
Format the named message using three argument and return the full message text.

Parameters:
message - The message name
arg1 - The first argument
arg2 - The second argument
arg3 - The third argument
Returns:
The full message text

format

public static java.lang.String format(java.lang.String message,
                                      java.lang.Object[] args)
Format the named message using any number of arguments and return the full message text.

Parameters:
message - The message name
args - Argument list
Returns:
The full message text

message

public static java.lang.String message(java.lang.String message)
Return the text of the named message without formatting.

Parameters:
message - The message name
Returns:
The full message text


Copyright © 2011. All Rights Reserved.