|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.github.fge.msgsimple.bundle.PropertiesBundle
public final class PropertiesBundle
Utility class to instantiate message bundles from Java property files
This is the class you will use if you want to load a legay ResourceBundle
(using legacyResourceBundle(String)
). However, if
you are starting a new bundle, it is recommended to use the other methods.
The generic method is forPath(String, Charset, long, TimeUnit)
.
You can therefore specify the character set and timeout. When no character
set is specified, the default is UTF-8, except for legacyResourceBundle(String)
which will read property files as ResourceBundle
does: in ISO-8859-1.
All constructors have a resourcePath
argument; in the same vein
as ResourceBundle
, the following inputs are allowed:
org/foobar/message.properties
;org/foobar/message
;/org/foobar/message.properties
;/org/foobar/message
.
MessageBundle
,
PropertiesMessageSource
,
MessageSourceLoader
,
LoadingMessageSourceProvider
Method Summary | |
---|---|
static MessageBundle |
forPath(String resourcePath)
Create a message bundle from a set of property files, using the UTF-8 character set |
static MessageBundle |
forPath(String resourcePath,
Charset charset,
long duration,
TimeUnit unit)
Create a message bundle from a set of property files, with a defined charset and expiry time |
static MessageBundle |
forPath(String resourcePath,
long duration,
TimeUnit timeUnit)
Create a message bundle from a set of property files, using the UTF-8 character set, and an expiry delay |
static MessageBundle |
legacyResourceBundle(String resourcePath)
Create a message bundle mimicking a ResourceBundle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static MessageBundle forPath(String resourcePath)
resourcePath
- the resource path
MessageBundle
NullPointerException
- resource path is nullpublic static MessageBundle forPath(String resourcePath, long duration, TimeUnit timeUnit)
resourcePath
- the resource pathduration
- expiry durationtimeUnit
- expiry time unit
MessageBundle
NullPointerException
- resource path or duration is null
IllegalArgumentException
- duration is 0 or lessLoadingMessageSourceProvider
public static MessageBundle forPath(String resourcePath, Charset charset, long duration, TimeUnit unit)
resourcePath
- the resource pathcharset
- the character setduration
- expiry durationunit
- expiry time unit
MessageBundle
NullPointerException
- resource path, charset or duration is null
IllegalArgumentException
- duration is 0 or lessLoadingMessageSourceProvider
public static MessageBundle legacyResourceBundle(String resourcePath)
ResourceBundle
Using this method will provide a MessageBundle
with the
following characteristics:
This method is only there for legacy reasons. Ultimately, you should choose to use a more modern (ie, UTF-8) message bundle instead.
resourcePath
- the resource path
PropertiesMessageSource.fromResource(String, Charset)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |