Package dev.boze.api.option
Class ToggleOption
- All Implemented Interfaces:
Serializable<Boolean>
A boolean option that can be toggled on or off
ToggleOption provides a simple way to store and modify boolean values
The value can only be true or false
-
Field Summary
Fields inherited from class dev.boze.api.option.Option
description, name, owner -
Constructor Summary
ConstructorsConstructorDescriptionToggleOption(BaseModule owner, String name, String description) Creates a new toggle option with a default value of falseToggleOption(BaseModule owner, String name, String description, boolean value) Creates a new toggle option with a specified default valueToggleOption(BaseModule owner, String name, String description, boolean value, Option<?> parent) Creates a new toggle option with a specified default value and parentToggleOption(BaseModule owner, String name, String description, boolean value, BooleanSupplier visibility) Creates a new toggle option with visibilityToggleOption(BaseModule owner, String name, String description, boolean value, BooleanSupplier visibility, Option<?> parent) Creates a new toggle option with visibility and parent -
Method Summary
Methods inherited from class dev.boze.api.option.Option
getFullName, getParent, isParent, isVisible, setParent, setVisibility
-
Constructor Details
-
ToggleOption
Creates a new toggle option with a default value of false- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this option
-
ToggleOption
Creates a new toggle option with a specified default value- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optionvalue- The initial value
-
ToggleOption
public ToggleOption(BaseModule owner, String name, String description, boolean value, Option<?> parent) Creates a new toggle option with a specified default value and parent- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optionvalue- The initial valueparent- The parent option, or null if this is a root option
-
ToggleOption
public ToggleOption(BaseModule owner, String name, String description, boolean value, BooleanSupplier visibility) Creates a new toggle option with visibility- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optionvalue- The initial valuevisibility- The visibility supplier for this option
-
ToggleOption
public ToggleOption(BaseModule owner, String name, String description, boolean value, BooleanSupplier visibility, Option<?> parent) Creates a new toggle option with visibility and parent- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optionvalue- The initial valuevisibility- The visibility supplier for this optionparent- The parent option, or null if this is a root option
-
-
Method Details
-
getValue
Description copied from class:OptionGets the current value of this option -
setValue
Description copied from class:OptionSets the value of this option -
reset
Description copied from class:OptionResets this option to its default value -
toJson
public com.google.gson.JsonObject toJson()- Returns:
- The object as a JsonObject
-
fromJson
- Parameters:
object- The JsonObject to deserialize- Returns:
- The deserialized object
-