Class OptionManager
java.lang.Object
com.realtime.crossfire.jxclient.settings.options.OptionManager
Maintains a set of named options.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Pair ofOption
and corresponding documentation string. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new option.@NotNull CheckBoxOption
getCheckBoxOption
(@NotNull String optionName) Returns a checkbox option.@NotNull Map<String,
OptionManager.Entry> Returns all defined option names.void
Loads all options' states from the backing settings instance.void
removeOption
(@NotNull String optionName) Removes an option by name.void
Saves all options' states to the backing settings instance.
-
Constructor Details
-
OptionManager
Creates a new instance.- Parameters:
settings
- the settings instance for loading/saving option values
-
-
Method Details
-
addOption
public void addOption(@NotNull @NotNull String optionName, @NotNull @NotNull String documentation, @NotNull @NotNull Option option) throws OptionException Adds a new option.- Parameters:
optionName
- the option name to adddocumentation
- the documentation string for the settingsoption
- the option to add- Throws:
OptionException
- if the option name is not unique
-
removeOption
Removes an option by name. Does nothing if the option does not exist.- Parameters:
optionName
- the option name to remove
-
getOptions
Returns all defined option names.- Returns:
- the option names
-
getCheckBoxOption
@NotNull public @NotNull CheckBoxOption getCheckBoxOption(@NotNull @NotNull String optionName) throws OptionException Returns a checkbox option.- Parameters:
optionName
- the option name to look up- Returns:
- the option
- Throws:
OptionException
- if the option name does not exist
-
loadOptions
public void loadOptions()Loads all options' states from the backing settings instance. -
saveOptions
public void saveOptions()Saves all options' states to the backing settings instance.
-