public class OptionManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
OptionManager.Entry
Pair of
Option and corresponding documentation string. |
Constructor and Description |
---|
OptionManager(@NotNull Settings settings)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addOption(@NotNull java.lang.String optionName,
@NotNull java.lang.String documentation,
@NotNull Option option)
Adds a new option.
|
@NotNull CheckBoxOption |
getCheckBoxOption(@NotNull java.lang.String optionName)
Returns a checkbox option.
|
@NotNull java.util.Map<java.lang.String,OptionManager.Entry> |
getOptions()
Returns all defined option names.
|
void |
loadOptions()
Loads all options' states from the backing settings instance.
|
void |
removeOption(@NotNull java.lang.String optionName)
Removes an option by name.
|
void |
saveOptions()
Saves all options' states to the backing settings instance.
|
public OptionManager(@NotNull @NotNull Settings settings)
settings
- the settings instance for loading/saving option valuespublic void addOption(@NotNull @NotNull java.lang.String optionName, @NotNull @NotNull java.lang.String documentation, @NotNull @NotNull Option option) throws OptionException
optionName
- the option name to adddocumentation
- the documentation string for the settingsoption
- the option to addOptionException
- if the option name is not uniquepublic void removeOption(@NotNull @NotNull java.lang.String optionName)
optionName
- the option name to remove@NotNull public @NotNull java.util.Map<java.lang.String,OptionManager.Entry> getOptions()
@NotNull public @NotNull CheckBoxOption getCheckBoxOption(@NotNull @NotNull java.lang.String optionName) throws OptionException
optionName
- the option name to look upOptionException
- if the option name does not existpublic void loadOptions()
public void saveOptions()