public class LocalizedMessage extends Object
| Modifier and Type | Class and Description |
|---|---|
protected class |
LocalizedMessage.FilteredArguments |
| Modifier and Type | Field and Description |
|---|---|
protected LocalizedMessage.FilteredArguments |
arguments |
static String |
DEFAULT_ENCODING |
protected String |
encoding |
protected LocalizedMessage.FilteredArguments |
extraArgs |
protected Filter |
filter |
protected String |
id |
protected ClassLoader |
loader |
protected String |
resource |
| Constructor and Description |
|---|
LocalizedMessage(String resource,
String id)
Constructs a new LocalizedMessage using
resource as the base name for the
RessourceBundle and id as the message bundle id the resource file. |
LocalizedMessage(String resource,
String id,
Object[] arguments)
Constructs a new LocalizedMessage using
resource as the base name for the
RessourceBundle and id as the message bundle id the resource file. |
LocalizedMessage(String resource,
String id,
String encoding)
Constructs a new LocalizedMessage using
resource as the base name for the
RessourceBundle and id as the message bundle id the resource file. |
LocalizedMessage(String resource,
String id,
String encoding,
Object[] arguments)
Constructs a new LocalizedMessage using
resource as the base name for the
RessourceBundle and id as the message bundle id the resource file. |
| Modifier and Type | Method and Description |
|---|---|
protected String |
addExtraArgs(String msg,
Locale locale) |
protected String |
formatWithTimeZone(String template,
Object[] arguments,
Locale locale,
TimeZone timezone) |
Object[] |
getArguments()
Returns an
Object[] containing the message arguments. |
ClassLoader |
getClassLoader()
Returns the
ClassLoader which loads the resource files or null
if the default ClassLoader is used. |
String |
getEntry(String key,
Locale loc,
TimeZone timezone)
Reads the entry
id + "." + key from the resource file and returns a
formated message for the given Locale and TimeZone. |
Object[] |
getExtraArgs() |
Filter |
getFilter()
Returns the current filter.
|
String |
getId()
Returns the id of the message in the resource bundle.
|
String |
getResource()
Returns the name of the resource bundle for this message
|
void |
setClassLoader(ClassLoader loader)
Set the
ClassLoader which loads the resource files. |
void |
setExtraArgument(Object extraArg) |
void |
setExtraArguments(Object[] extraArgs) |
void |
setFilter(Filter filter)
Sets the
Filter that is used to filter the arguments of this message |
String |
toString() |
protected final String id
protected final String resource
public static final String DEFAULT_ENCODING
protected String encoding
protected LocalizedMessage.FilteredArguments arguments
protected LocalizedMessage.FilteredArguments extraArgs
protected Filter filter
protected ClassLoader loader
public LocalizedMessage(String resource, String id) throws NullPointerException
resource as the base name for the
RessourceBundle and id as the message bundle id the resource file.resource - base name of the resource fileid - the id of the corresponding bundle in the resource fileNullPointerException - if resource or id is nullpublic LocalizedMessage(String resource, String id, String encoding) throws NullPointerException, UnsupportedEncodingException
resource as the base name for the
RessourceBundle and id as the message bundle id the resource file.resource - base name of the resource fileid - the id of the corresponding bundle in the resource fileencoding - the encoding of the resource fileNullPointerException - if resource or id is nullUnsupportedEncodingException - if the encoding is not supportedpublic LocalizedMessage(String resource, String id, Object[] arguments) throws NullPointerException
resource as the base name for the
RessourceBundle and id as the message bundle id the resource file.resource - base name of the resource fileid - the id of the corresponding bundle in the resource filearguments - an array containing the arguments for the messageNullPointerException - if resource or id is nullpublic LocalizedMessage(String resource, String id, String encoding, Object[] arguments) throws NullPointerException, UnsupportedEncodingException
resource as the base name for the
RessourceBundle and id as the message bundle id the resource file.resource - base name of the resource fileid - the id of the corresponding bundle in the resource fileencoding - the encoding of the resource filearguments - an array containing the arguments for the messageNullPointerException - if resource or id is nullUnsupportedEncodingException - if the encoding is not supportedpublic String getEntry(String key, Locale loc, TimeZone timezone) throws MissingEntryException
id + "." + key from the resource file and returns a
formated message for the given Locale and TimeZone.key - second part of the entry idloc - the used Localetimezone - the used TimeZoneMissingEntryException - if the resource file is not available or the entry does not exist.protected String formatWithTimeZone(String template, Object[] arguments, Locale locale, TimeZone timezone)
public void setFilter(Filter filter)
Filter that is used to filter the arguments of this messagefilter - the Filter to use. null to disable filtering.public Filter getFilter()
public void setClassLoader(ClassLoader loader)
ClassLoader which loads the resource files. If it is set to null
then the default ClassLoader is used.loader - the ClassLoader which loads the resource filespublic ClassLoader getClassLoader()
ClassLoader which loads the resource files or null
if the default ClassLoader is used.ClassLoader which loads the resource filespublic String getId()
public String getResource()
public Object[] getArguments()
Object[] containing the message arguments.public void setExtraArgument(Object extraArg)
extraArg - public void setExtraArguments(Object[] extraArgs)
extraArgs - public Object[] getExtraArgs()
Copyright © 2015. All rights reserved.