public static final class LoadingMessageSourceProvider.Builder extends Object
LoadingMessageSourceProvider| Modifier and Type | Method and Description |
|---|---|
MessageSourceProvider |
build()
Build the provider
|
LoadingMessageSourceProvider.Builder |
neverExpires()
Set this loading provider so that entries never expire
|
LoadingMessageSourceProvider.Builder |
setDefaultSource(MessageSource defaultSource)
Set the default message source if the loader fails to load
|
LoadingMessageSourceProvider.Builder |
setExpiryTime(long duration,
TimeUnit unit)
Set the source expiry time (10 minutes by default)
|
LoadingMessageSourceProvider.Builder |
setLoader(MessageSourceLoader loader)
Set the message source loader
|
LoadingMessageSourceProvider.Builder |
setLoadTimeout(long duration,
TimeUnit unit)
Set the load timeout (1 second by default)
|
public LoadingMessageSourceProvider.Builder setLoader(MessageSourceLoader loader)
loader - the loaderNullPointerException - loader is nullpublic LoadingMessageSourceProvider.Builder setDefaultSource(MessageSource defaultSource)
defaultSource - the default sourceNullPointerException - source is nullpublic LoadingMessageSourceProvider.Builder setLoadTimeout(long duration, TimeUnit unit)
If the loader passed as an argument fails to load a message source after the specified timeout is elapsed, then the default messagesource will be returned (if any).
duration - number of unitsunit - the time unitIllegalArgumentException - duration is negative or zeroNullPointerException - unit is nullsetLoader(MessageSourceLoader),
setDefaultSource(MessageSource)public LoadingMessageSourceProvider.Builder setExpiryTime(long duration, TimeUnit unit)
Do not use this method if you want no expiry at all; use
neverExpires() instead.
duration - number of unitsunit - the time unitIllegalArgumentException - duration is negative or zeroNullPointerException - unit is nullpublic LoadingMessageSourceProvider.Builder neverExpires()
public MessageSourceProvider build()
LoadingMessageSourceProviderIllegalArgumentException - no loader has been provided