org.PingOO.DLAI.lib.util
Class ResourceFormatter

java.lang.Object
  |
  +--org.PingOO.DLAI.lib.util.ResourceFormatter

public final class ResourceFormatter
extends java.lang.Object

Formats composed messages using the program language to match language and cultural dependant messages.

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)

Field Summary
private static java.text.MessageFormat FORMATTER
          The message formatter.
 
Constructor Summary
private ResourceFormatter()
          Hides the constructor from the outside.
 
Method Summary
static java.lang.String format(java.lang.String message, java.lang.Object[] values)
          Formats a composed message with the list of values.
private static void setFormatter()
          Sets the formatter instance.
static void setLocale(java.util.Locale locale)
          Changes the language used by the formatter.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

FORMATTER

private static java.text.MessageFormat FORMATTER
The message formatter.
Constructor Detail

ResourceFormatter

private ResourceFormatter()
Hides the constructor from the outside.
Method Detail

setLocale

public static final void setLocale(java.util.Locale locale)
Changes the language used by the formatter.
Parameters:
locale - The new language to use.

setFormatter

private static void setFormatter()
Sets the formatter instance.

format

public static final java.lang.String format(java.lang.String message,
                                            java.lang.Object[] values)
Formats a composed message with the list of values.
Parameters:
message - The original message.
values - The values to include in the message.
Returns:
The correctly formatted string or ResourceManager.EMPTY_LOCALIZED in case of error.