|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.github.fge.msgsimple.provider.LoadingMessageSourceProvider
@ThreadSafe public final class LoadingMessageSourceProvider
A caching, on-demand loading message source provider with configurable expiry
This class uses a MessageSourceLoader
internally to look up
message sources. As is the case for StaticMessageSourceProvider
, you
can also set a default source if the loader fails to grab a source.
Apart from the loader, you can customize two aspects of the provider:
Note that the expiry time is periodic only, and not per source. The loading result (success or failure) is recorded permanently until the expiry time kicks in.
In the event of a timeout, the task remains active until it gets a result; this means, for instance, that if you set up a timeout of 500 milliseconds, but the task takes 2 seconds to complete, during these two seconds, the default source will be returned instead.
You can also configure a loader so that it never expires.
You cannot instantiate that class directly; use newBuilder()
to
obtain a builder class and set up your provider.
LoadingMessageSourceProvider.Builder
Nested Class Summary | |
---|---|
static class |
LoadingMessageSourceProvider.Builder
Builder class for a LoadingMessageSourceProvider |
Method Summary | |
---|---|
MessageSource |
getMessageSource(Locale locale)
Provide a message source for a given locale |
static LoadingMessageSourceProvider.Builder |
newBuilder()
Create a new builder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static LoadingMessageSourceProvider.Builder newBuilder()
public MessageSource getMessageSource(Locale locale)
MessageSourceProvider
getMessageSource
in interface MessageSourceProvider
locale
- the locale
null
if none is found
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |