public class SimpleDefaultMessageMap extends Object implements DefaultMessageMap
DefaultMessageType
Modifier and Type | Field and Description |
---|---|
protected Map<DefaultMessageType,String> |
defaults
Defaults stored.
|
Constructor and Description |
---|
SimpleDefaultMessageMap()
Creates a default message map.
|
SimpleDefaultMessageMap(@Nullable String defaultString)
Creates a default message map and sets all messages to a single value.
|
Modifier and Type | Method and Description |
---|---|
@NonNull Optional<String> |
getDefault(DefaultMessageType key)
Retrieves the default string value for the specified default message
type, using
DefaultMessageType.getFallback() if not set in
this map. |
@NonNull Optional<String> |
getDefault(@NonNull DefaultMessageType key,
@Nullable String defaultValue)
Retrieves the default string value for the specified default message
type, using a provided default value if not set in this map.
|
@NonNull Map<DefaultMessageType,String> |
getDefaults()
Retrieves the full list of all
DefaultMessageType to String
mappings. |
@NonNull SimpleDefaultMessageMap |
setDefault(@NonNull DefaultMessageType key,
@Nullable String defaultString)
Sets a new default value for a given default message type.
|
protected final Map<DefaultMessageType,String> defaults
public SimpleDefaultMessageMap(@Nullable String defaultString)
defaultString
- value to be set for all stringspublic SimpleDefaultMessageMap()
public @NonNull SimpleDefaultMessageMap setDefault(@NonNull DefaultMessageType key, @Nullable String defaultString)
DefaultMessageMap
setDefault
in interface DefaultMessageMap
key
- message typedefaultString
- default valuepublic @NonNull Optional<String> getDefault(DefaultMessageType key)
DefaultMessageMap
DefaultMessageType.getFallback()
if not set in
this map.getDefault
in interface DefaultMessageMap
key
- message typepublic @NonNull Optional<String> getDefault(@NonNull DefaultMessageType key, @Nullable String defaultValue)
DefaultMessageMap
getDefault
in interface DefaultMessageMap
key
- message typedefaultValue
- a fallback value for if no default is setpublic @NonNull Map<DefaultMessageType,String> getDefaults()
DefaultMessageMap
DefaultMessageType
to String
mappings.getDefaults
in interface DefaultMessageMap
Copyright © 2013–2021 Kitteh. All rights reserved.