org.apache.commons.cli2.resource
Class ResourceHelper

java.lang.Object
  extended by org.apache.commons.cli2.resource.ResourceHelper

public class ResourceHelper
extends java.lang.Object

A utility class used to provide internationalisation support.

Author:
John Keyes

Field Summary
private  java.util.ResourceBundle bundle
          resource bundle
private static java.lang.String DEFAULT_BUNDLE
          default package name
private static ResourceHelper helper
           
private  java.lang.String prop
           
private static java.lang.String PROP_LOCALE
          system property
 
Constructor Summary
private ResourceHelper()
          Create a new ResourceHelper for the current locale.
 
Method Summary
 java.lang.String getBundleName()
           
 java.lang.String getMessage(java.lang.String key)
          Returns the message for the specified key.
 java.lang.String getMessage(java.lang.String key, java.lang.Object value)
          Returns the message for the specified key and argument.
 java.lang.String getMessage(java.lang.String key, java.lang.Object[] values)
          Returns the message for the specified key and arguments.
 java.lang.String getMessage(java.lang.String key, java.lang.Object value1, java.lang.Object value2)
          Returns the message for the specified key and arguments.
 java.lang.String getMessage(java.lang.String key, java.lang.Object value1, java.lang.Object value2, java.lang.Object value3)
          Returns the message for the specified key and arguments.
static ResourceHelper getResourceHelper()
          Gets the ResourceHelper appropriate to the current locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_LOCALE

private static final java.lang.String PROP_LOCALE
system property

See Also:
Constant Field Values

DEFAULT_BUNDLE

private static final java.lang.String DEFAULT_BUNDLE
default package name

See Also:
Constant Field Values

helper

private static ResourceHelper helper

bundle

private java.util.ResourceBundle bundle
resource bundle


prop

private java.lang.String prop
Constructor Detail

ResourceHelper

private ResourceHelper()
Create a new ResourceHelper for the current locale.

Method Detail

getBundleName

public java.lang.String getBundleName()

getResourceHelper

public static ResourceHelper getResourceHelper()
Gets the ResourceHelper appropriate to the current locale.

Returns:
a ResourceHelper

getMessage

public java.lang.String getMessage(java.lang.String key)
Returns the message for the specified key.

Parameters:
key - the unique identifier of the message
Returns:
String the formatted String

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   java.lang.Object value)
Returns the message for the specified key and argument.

Parameters:
key - the unique identifier of the message
value - the argument value
Returns:
String the formatted String

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   java.lang.Object value1,
                                   java.lang.Object value2)
Returns the message for the specified key and arguments.

Parameters:
key - the unique identifier of the message
value1 - an argument value
value2 - an argument value
Returns:
String the formatted String

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   java.lang.Object value1,
                                   java.lang.Object value2,
                                   java.lang.Object value3)
Returns the message for the specified key and arguments.

Parameters:
key - the unique identifier of the message
value1 - an argument value
value2 - an argument value
value3 - an argument value
Returns:
String the formatted String

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   java.lang.Object[] values)
Returns the message for the specified key and arguments.

Parameters:
key - the unique identifier of the message
values - argument values
Returns:
String the formatted String