Class ModeOption<T extends Enum<T>>
java.lang.Object
dev.boze.api.option.Option<T>
dev.boze.api.option.ModeOption<T>
- Type Parameters:
T- The enum type defining the available modes
- All Implemented Interfaces:
Serializable<T>
-
Field Summary
Fields inherited from class Option
description, name, owner -
Constructor Summary
ConstructorsConstructorDescriptionModeOption(BaseModule owner, String name, String description, T defaultValue) Creates a new mode optionModeOption(BaseModule owner, String name, String description, T defaultValue, Option<?> parent) Creates a new mode option with a parentModeOption(BaseModule owner, String name, String description, T defaultValue, BooleanSupplier visibility) Creates a new mode option with visibilityModeOption(BaseModule owner, String name, String description, T defaultValue, BooleanSupplier visibility, Option<?> parent) Creates a new mode option with visibility and parent -
Method Summary
Modifier and TypeMethodDescriptionfromJson(com.google.gson.JsonObject object) Gets the enum class of this mode optionGets the name of the current modegetModes()Gets a list of all available mode namesgetValue()Gets the current value of this optionGets the name of the current valuereset()Resets this option to its default valueSets the value of this optionvoidsetValueByName(String name) Sets the current mode by namecom.google.gson.JsonObjecttoJson()Methods inherited from class Option
getFullName, getParent, isParent, isVisible, setParent, setVisibility
-
Constructor Details
-
ModeOption
Creates a new mode option- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optiondefaultValue- The initial value and default value
-
ModeOption
public ModeOption(BaseModule owner, String name, String description, T defaultValue, Option<?> parent) Creates a new mode option with a parent- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optiondefaultValue- The initial value and default valueparent- The parent option, or null if this is a root option
-
ModeOption
public ModeOption(BaseModule owner, String name, String description, T defaultValue, BooleanSupplier visibility) Creates a new mode option with visibility- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optiondefaultValue- The initial value and default valuevisibility- The visibility supplier for this option
-
ModeOption
public ModeOption(BaseModule owner, String name, String description, T defaultValue, BooleanSupplier visibility, Option<?> parent) Creates a new mode option with visibility and parent- Parameters:
owner- The module that owns this optionname- The name of this optiondescription- The description of this optiondefaultValue- The initial value and default valuevisibility- The visibility supplier for this optionparent- The parent option, or null if this is a root option
-
-
Method Details
-
getEnumClass
-
getModes
-
getModeName
-
getValueName
-
getValue
-
setValue
-
reset
-
setValueByName
Sets the current mode by nameThe name is case-insensitive
- Parameters:
name- The name of the mode to set
-
toJson
public com.google.gson.JsonObject toJson()- Returns:
- The object as a JsonObject
-
fromJson
- Parameters:
object- The JsonObject to deserialize- Returns:
- The deserialized object
-