Package org.bouncycastle.pkix.util
Class LocalizedMessage
java.lang.Object
org.bouncycastle.pkix.util.LocalizedMessage
- Direct Known Subclasses:
LocaleString
,TextBundle
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected LocalizedMessage.FilteredArguments
static final String
protected String
protected LocalizedMessage.FilteredArguments
protected Filter
protected final String
protected ClassLoader
protected final String
-
Constructor Summary
ConstructorDescriptionLocalizedMessage
(String resource, String id) Constructs a new LocalizedMessage usingresource
as the base name for the RessourceBundle andid
as the message bundle id the resource file.LocalizedMessage
(String resource, String id, Object[] arguments) Constructs a new LocalizedMessage usingresource
as the base name for the RessourceBundle andid
as the message bundle id the resource file.LocalizedMessage
(String resource, String id, String encoding) Constructs a new LocalizedMessage usingresource
as the base name for the RessourceBundle andid
as the message bundle id the resource file.LocalizedMessage
(String resource, String id, String encoding, Object[] arguments) Constructs a new LocalizedMessage usingresource
as the base name for the RessourceBundle andid
as the message bundle id the resource file. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
addExtraArgs
(String msg, Locale locale) protected String
formatWithTimeZone
(String template, Object[] arguments, Locale locale, TimeZone timezone) Object[]
Returns anObject[]
containing the message arguments.Returns theClassLoader
which loads the resource files ornull
if the default ClassLoader is used.Reads the entryid + "." + key
from the resource file and returns a formated message for the given Locale and TimeZone.Object[]
Returns the current filter.getId()
Returns the id of the message in the resource bundle.Returns the name of the resource bundle for this messagevoid
setClassLoader
(ClassLoader loader) Set theClassLoader
which loads the resource files.void
setExtraArgument
(Object extraArg) void
setExtraArguments
(Object[] extraArgs) void
Sets theFilter
that is used to filter the arguments of this messagetoString()
-
Field Details
-
id
-
resource
-
DEFAULT_ENCODING
- See Also:
-
encoding
-
arguments
-
extraArgs
-
filter
-
loader
-
-
Constructor Details
-
LocalizedMessage
Constructs a new LocalizedMessage usingresource
as the base name for the RessourceBundle andid
as the message bundle id the resource file.- Parameters:
resource
- base name of the resource fileid
- the id of the corresponding bundle in the resource file- Throws:
NullPointerException
- ifresource
orid
isnull
-
LocalizedMessage
public LocalizedMessage(String resource, String id, String encoding) throws NullPointerException, UnsupportedEncodingException Constructs a new LocalizedMessage usingresource
as the base name for the RessourceBundle andid
as the message bundle id the resource file.- Parameters:
resource
- base name of the resource fileid
- the id of the corresponding bundle in the resource fileencoding
- the encoding of the resource file- Throws:
NullPointerException
- ifresource
orid
isnull
UnsupportedEncodingException
- if the encoding is not supported
-
LocalizedMessage
Constructs a new LocalizedMessage usingresource
as the base name for the RessourceBundle andid
as the message bundle id the resource file.- Parameters:
resource
- base name of the resource fileid
- the id of the corresponding bundle in the resource filearguments
- an array containing the arguments for the message- Throws:
NullPointerException
- ifresource
orid
isnull
-
LocalizedMessage
public LocalizedMessage(String resource, String id, String encoding, Object[] arguments) throws NullPointerException, UnsupportedEncodingException Constructs a new LocalizedMessage usingresource
as the base name for the RessourceBundle andid
as the message bundle id the resource file.- Parameters:
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 message- Throws:
NullPointerException
- ifresource
orid
isnull
UnsupportedEncodingException
- if the encoding is not supported
-
-
Method Details
-
getEntry
Reads the entryid + "." + key
from the resource file and returns a formated message for the given Locale and TimeZone.- Parameters:
key
- second part of the entry idloc
- the usedLocale
timezone
- the usedTimeZone
- Returns:
- a Strng containing the localized message
- Throws:
MissingEntryException
- if the resource file is not available or the entry does not exist.
-
formatWithTimeZone
-
addExtraArgs
-
setFilter
Sets theFilter
that is used to filter the arguments of this message- Parameters:
filter
- theFilter
to use.null
to disable filtering.
-
getFilter
Returns the current filter.- Returns:
- the current filter
-
setClassLoader
Set theClassLoader
which loads the resource files. If it is set tonull
then the defaultClassLoader
is used.- Parameters:
loader
- theClassLoader
which loads the resource files
-
getClassLoader
Returns theClassLoader
which loads the resource files ornull
if the default ClassLoader is used.- Returns:
- the
ClassLoader
which loads the resource files
-
getId
Returns the id of the message in the resource bundle.- Returns:
- the id of the message
-
getResource
Returns the name of the resource bundle for this message- Returns:
- name of the resource file
-
getArguments
Returns anObject[]
containing the message arguments.- Returns:
- the message arguments
-
setExtraArgument
- Parameters:
extraArg
-
-
setExtraArguments
- Parameters:
extraArgs
-
-
getExtraArgs
- Returns:
-
toString
-