MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mysql.clusterj.core.util.I18NHelper Class Reference

Public Member Functions

String message (String messageKey)
String message (String messageKey, Object arg1)
String message (String messageKey, Object arg1, Object arg2)
String message (String messageKey, Object...args)
String message (String messageKey, int arg)
String message (String messageKey, boolean arg)
ResourceBundle getResourceBundle ()

Static Public Member Functions

static I18NHelper getInstance (String bundleName)
static I18NHelper getInstance (final Class<?> cls)
static I18NHelper getInstance (String bundleName, ClassLoader loader)

Detailed Description

Helper class for constructing messages from bundles. The intended usage of this class is to construct a new instance bound to a bundle, as in

I18NHelper local = I18NHelper.getInstance("com.mysql.clusterj.core.Bundle");

This call uses the class loader that loaded the I18NHelper class to find the specified Bundle. The class provides two overloaded getInstance methods allowing to specify a different class loader: getInstance(Class cls) looks for a bundle called "Bundle.properties" located in the package of the specified class object and getInstance(String bundleName,ClassLoader loader) uses the specified class loader to find the bundle.

Subsequently, instance methods can be used to format message strings using the text from the bundle, as in

throw new JDOFatalInternalException (local.message("ERR_NoMetadata", cls.getName()));

Definition at line 48 of file I18NHelper.java.

Member Function Documentation

static I18NHelper com.mysql.clusterj.core.util.I18NHelper.getInstance ( String  bundleName)
inlinestatic

An instance bound to a bundle. This method uses the current class loader to find the bundle.

Parameters
bundleNamethe name of the bundle
Returns
the helper instance bound to the bundle

Definition at line 106 of file I18NHelper.java.

Here is the caller graph for this function:

static I18NHelper com.mysql.clusterj.core.util.I18NHelper.getInstance ( final Class<?>  cls)
inlinestatic

An instance bound to a bundle. This method figures out the bundle name for the class object's package and uses the class' class loader to find the bundle. Note, the specified class object must not be null.

Parameters
clsthe class object from which to load the resource bundle
Returns
the helper instance bound to the bundle

Definition at line 117 of file I18NHelper.java.

Here is the call graph for this function:

static I18NHelper com.mysql.clusterj.core.util.I18NHelper.getInstance ( String  bundleName,
ClassLoader  loader 
)
inlinestatic

An instance bound to a bundle. This method uses the specified class loader to find the bundle. Note, the specified class loader must not be null.

Parameters
bundleNamethe name of the bundle
loaderthe class loader from which to load the resource bundle
Returns
the helper instance bound to the bundle

Definition at line 137 of file I18NHelper.java.

ResourceBundle com.mysql.clusterj.core.util.I18NHelper.getResourceBundle ( )
inline

Returns the resource bundle used by this I18NHelper.

Returns
the associated resource bundle

Definition at line 213 of file I18NHelper.java.

String com.mysql.clusterj.core.util.I18NHelper.message ( String  messageKey)
inline

Message formatter

Parameters
messageKeythe message key
Returns
the resolved message text

Definition at line 154 of file I18NHelper.java.

String com.mysql.clusterj.core.util.I18NHelper.message ( String  messageKey,
Object  arg1 
)
inline

Message formatter

Parameters
messageKeythe message key
arg1the first argument
Returns
the resolved message text

Definition at line 164 of file I18NHelper.java.

String com.mysql.clusterj.core.util.I18NHelper.message ( String  messageKey,
Object  arg1,
Object  arg2 
)
inline

Message formatter

Parameters
messageKeythe message key
arg1the first argument
arg2the second argument
Returns
the resolved message text

Definition at line 175 of file I18NHelper.java.

String com.mysql.clusterj.core.util.I18NHelper.message ( String  messageKey,
Object...  args 
)
inline

Message formatter

Parameters
messageKeythe message key
argsthe array of arguments
Returns
the resolved message text

Definition at line 185 of file I18NHelper.java.

String com.mysql.clusterj.core.util.I18NHelper.message ( String  messageKey,
int  arg 
)
inline

Message formatter

Parameters
messageKeythe message key
argthe argument
Returns
the resolved message text

Definition at line 195 of file I18NHelper.java.

String com.mysql.clusterj.core.util.I18NHelper.message ( String  messageKey,
boolean  arg 
)
inline

Message formatter

Parameters
messageKeythe message key
argthe argument
Returns
the resolved message text

Definition at line 205 of file I18NHelper.java.


The documentation for this class was generated from the following file: