public final class CachingTranslationProvider extends Object implements TranslationProvider
TranslationProvider that caches results returned from its wrapped provider if possible.
 Messages with placeholders cannot be cached.
| Constructor and Description | 
|---|
CachingTranslationProvider(TranslationProvider backingProvider)  | 
| Modifier and Type | Method and Description | 
|---|---|
String | 
applyPlaceholders(String raw,
                 Object... placeholders)
Applied placeholders to the given raw message. 
 | 
@Nullable String | 
get(String key)
Returns a message of a single line. 
 | 
@Nullable String | 
get(String key,
   Object... placeholders)
Returns a message of a single line. 
 | 
@Nullable List<String> | 
getList(String key)
Returns a message of one or more lines. 
 | 
@Nullable List<String> | 
getList(String key,
       Object... placeholders)
Returns a message of one or more lines. 
 | 
public CachingTranslationProvider(TranslationProvider backingProvider)
public @Nullable String get(String key)
TranslationProviderget in interface TranslationProviderkey - the key of the requested messagepublic @Nullable String get(String key, Object... placeholders)
TranslationProviderget in interface TranslationProviderkey - the key of the requested messageplaceholders - the placeholders to use in this messagepublic @Nullable List<String> getList(String key)
TranslationProvidergetList in interface TranslationProviderkey - the key of the requested messagepublic @Nullable List<String> getList(String key, Object... placeholders)
TranslationProvidergetList in interface TranslationProviderkey - the key of the requested messageplaceholders - the placeholders to use in this messagepublic String applyPlaceholders(String raw, Object... placeholders)
TranslationProviderapplyPlaceholders in interface TranslationProviderraw - the raw message to processplaceholders - placeholders to use