Package dev.cashire.cashconfig.items
Class ConfigNumber
Configuration item for Numerical values for
BaseConfigItem
.-
Nested Class Summary
Nested classes/interfaces inherited from class dev.cashire.cashconfig.items.BaseConfigItem
BaseConfigItem.Type
-
Field Summary
Fields inherited from class dev.cashire.cashconfig.items.BaseConfigItem
key, type, value
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty Number item with no key if adding to aConfigGroup
, useConfigNumber(String, Number)
instead.ConfigNumber(@NotNull String key)
Creates a new Number item with given key.ConfigNumber(@NotNull String key, Number value)
Creates a new Number item with given key and value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
fromJson(@NotNull com.google.gson.JsonElement element)
Deserialize data from theJsonElement
into this item.void
toJson(@NotNull com.google.gson.JsonArray parent)
Serializes data into the givenJsonArray
This item'sBaseConfigItem.getKey()
value is ignored in this case.void
toJson(@NotNull com.google.gson.JsonObject parent)
Serializes data into the givenJsonObject
.
-
Constructor Details
-
ConfigNumber
public ConfigNumber()Creates an empty Number item with no key if adding to aConfigGroup
, useConfigNumber(String, Number)
instead. -
ConfigNumber
Creates a new Number item with given key.- Parameters:
key
- The key to be used if put in a group.
-
ConfigNumber
Creates a new Number item with given key and value.- Parameters:
key
- The key to be used if put in a group.value
- The default value contained in this item.
-
-
Method Details
-
toJson
public void toJson(@NotNull @NotNull com.google.gson.JsonObject parent)Description copied from class:BaseConfigItem
Serializes data into the givenJsonObject
. This item is put in theJsonObject
at key value given byBaseConfigItem.getKey()
. It is put in as type given byBaseConfigItem.getType()
- Specified by:
toJson
in classBaseConfigItem<Number>
- Parameters:
parent
-JsonObject
to add this item to.
-
toJson
public void toJson(@NotNull @NotNull com.google.gson.JsonArray parent)Description copied from class:BaseConfigItem
Serializes data into the givenJsonArray
This item'sBaseConfigItem.getKey()
value is ignored in this case. It is put in as type given byBaseConfigItem.getType()
- Specified by:
toJson
in classBaseConfigItem<Number>
- Parameters:
parent
-JsonArray
to add to this item to.
-
fromJson
public void fromJson(@NotNull @NotNull com.google.gson.JsonElement element)Description copied from class:BaseConfigItem
Deserialize data from theJsonElement
into this item. Treats theJsonElement
as the type given byBaseConfigItem.getType()
- Specified by:
fromJson
in classBaseConfigItem<Number>
- Parameters:
element
-JsonElement
to load data from.
-