public abstract class I18nMessageFactory extends Object
MessageFactory
for I18n supported messages.Modifier and Type | Field and Description |
---|---|
static ResourceBundle.Control |
DEFAULT_RELOAD_CONTROL
Default is
ReloadControl.Always . |
protected static ResourceBundle.Control |
reloadControl
Do not use the default reload control to avoid loading the resource bundle upon each request.
|
Constructor and Description |
---|
I18nMessageFactory() |
Modifier and Type | Method and Description |
---|---|
protected I18nMessage |
createMessage(String bundlePath,
int code)
Factory method to create a new
I18nMessage instance that is filled with the formatted message with id code
from the resource bundle bundlePath . |
protected I18nMessage |
createMessage(String bundlePath,
int code,
Object... arguments)
Factory method to create a new
I18nMessage instance that is filled with the formatted message with id code
from the resource bundle bundlePath . |
protected I18nMessage |
createMessage(String bundlePath,
int code,
Object arg)
Factory method to create a new
I18nMessage instance that is filled with the formatted message with id code
from the resource bundle bundlePath . |
protected I18nMessage |
createMessage(String bundlePath,
int code,
Object arg1,
Object arg2)
Factory method to create a new
I18nMessage instance that is filled with the formatted message with id code
from the resource bundle bundlePath . |
protected I18nMessage |
createMessage(String bundlePath,
int code,
Object arg1,
Object arg2,
Object arg3)
Factory method to create a new
I18nMessage instance that is filled with the formatted message with id code
from the resource bundle bundlePath . |
static I18nMessage |
createStaticMessage(String message)
Factory method to create a
I18nMessage instance that is not read from a resource bundle. |
static I18nMessage |
createStaticMessage(String message,
Object... arguments)
Factory method to create a
I18nMessage instance that is not read from a resource bundle. |
protected ResourceBundle |
getBundle(String bundlePath) |
protected static String |
getBundlePath(String bundleName)
Computes the bundle's full path (
META-INF/org/mule/i18n/<bundleName>-messages.properties ) from
bundleName . |
protected ClassLoader |
getClassLoader()
Override this method to return the classloader for the bundle/module which contains the needed resource files.
|
protected ResourceBundle.Control |
getReloadControl()
Subclasses should override to customize the bundle reload control.
|
protected String |
getString(String bundlePath,
int code)
Factory method to read the message with code
code from the resource bundle. |
protected String |
getString(String bundlePath,
int code,
Object arg)
Factory method to read the message with code
code from the resource bundle. |
protected String |
getString(String bundlePath,
int code,
Object[] args) |
protected String |
getString(String bundlePath,
int code,
Object arg1,
Object arg2)
Factory method to read the message with code
code from the resource bundle. |
public static final ResourceBundle.Control DEFAULT_RELOAD_CONTROL
ReloadControl.Always
.protected static final ResourceBundle.Control reloadControl
protected static String getBundlePath(String bundleName)
META-INF/org/mule/i18n/<bundleName>-messages.properties
) from
bundleName
.bundleName
- Name of the bundle without the "messages" suffix and without file extension.protected I18nMessage createMessage(String bundlePath, int code, Object arg)
I18nMessage
instance that is filled with the formatted message with id code
from the resource bundle bundlePath
.bundlePath
- complete path to the resource bundle for lookupcode
- numeric code of the messagearg
- getBundlePath(String)
protected I18nMessage createMessage(String bundlePath, int code, Object arg1, Object arg2)
I18nMessage
instance that is filled with the formatted message with id code
from the resource bundle bundlePath
.bundlePath
- complete path to the resource bundle for lookupcode
- numeric code of the messagearg1
- arg2
- getBundlePath(String)
protected I18nMessage createMessage(String bundlePath, int code, Object arg1, Object arg2, Object arg3)
I18nMessage
instance that is filled with the formatted message with id code
from the resource bundle bundlePath
.bundlePath
- complete path to the resource bundle for lookupcode
- numeric code of the messagearg1
- arg2
- arg3
- getBundlePath(String)
protected I18nMessage createMessage(String bundlePath, int code, Object... arguments)
I18nMessage
instance that is filled with the formatted message with id code
from the resource bundle bundlePath
.
Attention: do not confuse this method with this#createMessage
.bundlePath
- complete path to the resource bundle for lookupcode
- numeric code of the messagearguments
- getBundlePath(String)
protected I18nMessage createMessage(String bundlePath, int code)
I18nMessage
instance that is filled with the formatted message with id code
from the resource bundle bundlePath
.bundlePath
- complete path to the resource bundle for lookupcode
- numeric code of the messagepublic static I18nMessage createStaticMessage(String message)
I18nMessage
instance that is not read from a resource bundle.message
- Message's message textpublic static I18nMessage createStaticMessage(String message, Object... arguments)
I18nMessage
instance that is not read from a resource bundle.message
- Static message text that may contain format specifiersarguments
- Arguments referenced by the format specifiers in the message string.protected String getString(String bundlePath, int code)
code
from the resource bundle.bundlePath
- complete path to the resource bundle for lookupcode
- numeric code of the messageString
protected String getString(String bundlePath, int code, Object arg)
code
from the resource bundle.bundlePath
- complete path to the resource bundle for lookupcode
- numeric code of the messagearg
- String
protected String getString(String bundlePath, int code, Object arg1, Object arg2)
code
from the resource bundle.bundlePath
- complete path to the resource bundle for lookupcode
- numeric code of the messagearg1
- arg2
- String
protected ResourceBundle getBundle(String bundlePath)
MissingResourceException
- if resource is missingprotected ClassLoader getClassLoader()
protected ResourceBundle.Control getReloadControl()
DEFAULT_RELOAD_CONTROL
Copyright © 2018. All rights reserved.