Package dev.cashire.cashconfig.items
Class ConfigString
Configuration item for String 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 String item with no key If adding to aConfigGroup
, useConfigString(String, String)
instead.ConfigString(@NotNull String key)
Creates a new String item with given key.ConfigString(@NotNull String key, String str)
Creates a new String 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
-
ConfigString
public ConfigString()Creates an empty String item with no key If adding to aConfigGroup
, useConfigString(String, String)
instead. -
ConfigString
Creates a new String item with given key.- Parameters:
key
- The key to be used if put in a group.
-
ConfigString
Creates a new String item with given key and value.- Parameters:
key
- The key to be used if put in a group.str
- 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<String>
- 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<String>
- 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<String>
- Parameters:
element
-JsonElement
to load data from.
-