public class LocalizedMessage
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
LocalizedMessage.FilteredArguments |
Modifier and Type | Field and Description |
---|---|
protected LocalizedMessage.FilteredArguments |
arguments |
static java.lang.String |
DEFAULT_ENCODING |
protected java.lang.String |
encoding |
protected LocalizedMessage.FilteredArguments |
extraArgs |
protected Filter |
filter |
protected java.lang.String |
id |
protected java.lang.ClassLoader |
loader |
protected java.lang.String |
resource |
Constructor and Description |
---|
LocalizedMessage(java.lang.String resource,
java.lang.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(java.lang.String resource,
java.lang.String id,
java.lang.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(java.lang.String resource,
java.lang.String id,
java.lang.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(java.lang.String resource,
java.lang.String id,
java.lang.String encoding,
java.lang.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 java.lang.String |
addExtraArgs(java.lang.String msg,
java.util.Locale locale) |
protected java.lang.String |
formatWithTimeZone(java.lang.String template,
java.lang.Object[] arguments,
java.util.Locale locale,
java.util.TimeZone timezone) |
java.lang.Object[] |
getArguments()
Returns an
Object[] containing the message arguments. |
java.lang.ClassLoader |
getClassLoader()
Returns the
ClassLoader which loads the resource files or null
if the default ClassLoader is used. |
java.lang.String |
getEntry(java.lang.String key,
java.util.Locale loc,
java.util.TimeZone timezone)
Reads the entry
id + "." + key from the resource file and returns a
formated message for the given Locale and TimeZone. |
java.lang.Object[] |
getExtraArgs() |
Filter |
getFilter()
Returns the current filter.
|
java.lang.String |
getId()
Returns the id of the message in the resource bundle.
|
java.lang.String |
getResource()
Returns the name of the resource bundle for this message
|
void |
setClassLoader(java.lang.ClassLoader loader)
Set the
ClassLoader which loads the resource files. |
void |
setExtraArgument(java.lang.Object extraArg) |
void |
setExtraArguments(java.lang.Object[] extraArgs) |
void |
setFilter(Filter filter)
Sets the
Filter that is used to filter the arguments of this message |
java.lang.String |
toString() |
protected final java.lang.String id
protected final java.lang.String resource
public static final java.lang.String DEFAULT_ENCODING
protected java.lang.String encoding
protected LocalizedMessage.FilteredArguments arguments
protected LocalizedMessage.FilteredArguments extraArgs
protected Filter filter
protected java.lang.ClassLoader loader
public LocalizedMessage(java.lang.String resource, java.lang.String id) throws java.lang.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 filejava.lang.NullPointerException
- if resource
or id
is null
public LocalizedMessage(java.lang.String resource, java.lang.String id, java.lang.String encoding) throws java.lang.NullPointerException, java.io.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 filejava.lang.NullPointerException
- if resource
or id
is null
java.io.UnsupportedEncodingException
- if the encoding is not supportedpublic LocalizedMessage(java.lang.String resource, java.lang.String id, java.lang.Object[] arguments) throws java.lang.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 messagejava.lang.NullPointerException
- if resource
or id
is null
public LocalizedMessage(java.lang.String resource, java.lang.String id, java.lang.String encoding, java.lang.Object[] arguments) throws java.lang.NullPointerException, java.io.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 messagejava.lang.NullPointerException
- if resource
or id
is null
java.io.UnsupportedEncodingException
- if the encoding is not supportedpublic java.lang.String getEntry(java.lang.String key, java.util.Locale loc, java.util.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 Locale
timezone
- the used TimeZone
MissingEntryException
- if the resource file is not available or the entry does not exist.protected java.lang.String formatWithTimeZone(java.lang.String template, java.lang.Object[] arguments, java.util.Locale locale, java.util.TimeZone timezone)
protected java.lang.String addExtraArgs(java.lang.String msg, java.util.Locale locale)
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(java.lang.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 java.lang.ClassLoader getClassLoader()
ClassLoader
which loads the resource files or null
if the default ClassLoader is used.ClassLoader
which loads the resource filespublic java.lang.String getId()
public java.lang.String getResource()
public java.lang.Object[] getArguments()
Object[]
containing the message arguments.public void setExtraArgument(java.lang.Object extraArg)
extraArg
- public void setExtraArguments(java.lang.Object[] extraArgs)
extraArgs
- public java.lang.Object[] getExtraArgs()
public java.lang.String toString()
toString
in class java.lang.Object