Package dev.demeng.pluginbase.locale
Interface LocaleReader
- All Known Implementing Classes:
ConfigLocaleReader
public interface LocaleReader
A locale reader is a source in which messages for a specific locale are fetched. This can be a
file, a resource bundle, or even a remote source.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(@NotNull String key) Returns whether this reader contains a mapping for the given key.Returns the mapping value for this key.String[]Returns the mapping value for this key.@NotNull LocaleReturns the locale of by this readerstatic @NotNull LocaleReaderwrap(@NotNull ResourceBundle bundle) Wraps aResourceBundlein aLocaleReader.
-
Method Details
-
containsKey
Returns whether this reader contains a mapping for the given key.- Parameters:
key- Key to check for- Returns:
trueif this reader has a mapping for the key
-
get
Returns the mapping value for this key. It is recommended that this only return values ifcontainsKey(String)is true, otherwise throwing an exception to avoid confusion.- Parameters:
key- Key to fetch for- Returns:
- The string value
-
getArray
Returns the mapping value for this key. It is recommended that this only return values ifcontainsKey(String)is true, otherwise throwing an exception to avoid confusion.- Parameters:
key- Key to fetch for- Returns:
- The string array value
-
getLocale
Returns the locale of by this reader- Returns:
- The reader's locale
-
wrap
Wraps aResourceBundlein aLocaleReader.- Parameters:
bundle- Bundle to wrap- Returns:
- The locale reader
-