|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.universAAL.middleware.container.utils.Messages
public class Messages
The properties file consists of lines with key-value pairs (called
'messages'). In addition to simplify the reading of configuration files, this
class also handles messages in different files representing the messages in
different languages. When a message is not available in the localized
language, the corresponding value for the default language is returned.
If the default file name is messages.properties, the file name for a
different language include a language code as lowercase ISO 639 code, e.g.
for english, the file name would be messages_en.properties.
Constructor Summary | |
---|---|
Messages(File propertiesFile)
Constructor: opens the file with the given descriptor and loads all messages. |
|
Messages(File propertiesFile,
Locale initialLocale)
Constructor: opens the file with the given descriptor and loads all messages. |
|
Messages(URL propertiesURL)
Constructor: opens the file with the given descriptor and loads all messages. |
|
Messages(URL propertiesURL,
Locale initialLocale)
Constructor: opens the file with the given descriptor and loads all messages. |
Method Summary | |
---|---|
Locale |
getCurrentLocale()
Get the current Locale used for messages. |
String |
getString(String key)
Get the value for a given key. |
void |
setLocale(Locale loc)
Try to change the locale for messages. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Messages(File propertiesFile) throws IOException, IllegalArgumentException
propertiesFile
- the properties file to use to load the messages.
IOException
- if the propertiesFile does not exist
IllegalArgumentException
- if propertiesFile has incorrect extensionpublic Messages(File propertiesFile, Locale initialLocale) throws IOException, IllegalArgumentException
propertiesFile
- the properties file to use to load the messages.initialLocale
- the initialLocale to be used.
IOException
- if the propertiesFile does not exist
(but not if the internationalized file does not exist)
IllegalArgumentException
- if propertiesFile has incorrect extensionpublic Messages(URL propertiesURL) throws IOException, IllegalArgumentException
propertiesURL
- the properties file to use to load the messages.
IOException
- if the propertiesURL does not exist
IllegalArgumentException
- if propertiesURL has incorrect extensionpublic Messages(URL propertiesURL, Locale initialLocale) throws IOException, IllegalArgumentException
propertiesURL
- the properties file to use to load the messages.initialLocale
- the initialLocale to be used.
IOException
- if the propertiesURL does not exist
(but not if the internationalized file does not exist)
IllegalArgumentException
- if propertiesURL has incorrect extensionMethod Detail |
---|
public void setLocale(Locale loc)
loc
- public Locale getCurrentLocale()
public String getString(String key)
key
- The key.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |