S - the setting typepublic final class SettingMapFactory<S extends Setting<V>,V extends Setting.State> extends Object
SettingMaps for a given realm of settings and states.
It is safe to introduce additional settings and states, so long as the ordinal values of existing ones are not affected.
| Modifier and Type | Method and Description |
|---|---|
static <S extends Enum<S> & Setting<V>,V extends Enum<V> & Setting.State> |
create(Class<S> settingsEnum,
Class<V> statesEnum)
|
static <S extends Setting<V>,V extends Setting.State> |
create(S[] settings,
V[] states)
|
SettingMap<S,V> |
decode(byte[] buf)
Decodes the given byte array to a
SettingMap. |
SettingMap<S,V> |
decode(String encodedString)
Decodes the given string to a
SettingMap. |
S[] |
getSettings()
Gets the
Setting instances. |
V[] |
getStates()
Gets the
Setting.State instances. |
SettingMap<S,V> |
newMap()
Creates a new
SettingMap, with the default states set for each of the settings. |
public static <S extends Enum<S> & Setting<V>,V extends Enum<V> & Setting.State> SettingMapFactory<S,V> create(Class<S> settingsEnum, Class<V> statesEnum)
SettingMapFactory for the given Setting and Setting.State enums.
Factories should ideally be cached (stored in a static field) in the setting enum and reused.
S - the class typesettingsEnum - the setting enumstatesEnum - the states enumpublic static <S extends Setting<V>,V extends Setting.State> SettingMapFactory<S,V> create(S[] settings, V[] states)
SettingMapFactory for the given Settings and Setting.States.
Factories should ideally be cached (stored in a static field) in the setting class.
S - the class typesettings - the settingspublic V[] getStates()
Setting.State instances.public SettingMap<S,V> newMap()
SettingMap, with the default states set for each of the settings.public SettingMap<S,V> decode(byte[] buf)
SettingMap.
Operates on the reverse of SettingMap.encode().
buf - the byte arraypublic SettingMap<S,V> decode(String encodedString)
SettingMap.
Operates on the reverse of SettingMap.encodeToString().
encodedString - the stringCopyright © 2020. All rights reserved.