public class TextConfigSerializer extends AbstractDataBuilder<Text> implements ninja.leaping.configurate.objectmapping.serialize.TypeSerializer<Text>
TypeSerializer
for Text
objects. Serialization
is handled by serializing the text to String with the
TextSerializers.JSON
serializer, loading the String into a
GsonConfigurationLoader
, and setting the value of the
ConfigurationNode
to the root node of the GsonConfigurationLoader.
Although JSON is used for serialization internally, this has no effect on
the actual configuration format the developer chooses to use.Constructor and Description |
---|
TextConfigSerializer()
Creates a new
TextConfigSerializer . |
Modifier and Type | Method and Description |
---|---|
protected Optional<Text> |
buildContent(DataView container)
Builds the currently
AbstractDataBuilder.supportedVersion variant of the intended
DataSerializable , such that all content upgrades have already
been handled by AbstractDataBuilder.build(DataView) . |
Text |
deserialize(TypeToken<?> type,
ninja.leaping.configurate.ConfigurationNode value) |
void |
serialize(TypeToken<?> type,
Text obj,
ninja.leaping.configurate.ConfigurationNode value) |
build
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
from, reset
public TextConfigSerializer()
TextConfigSerializer
. Normally this should not
need to be created more than once.public Text deserialize(TypeToken<?> type, ninja.leaping.configurate.ConfigurationNode value) throws ninja.leaping.configurate.objectmapping.ObjectMappingException
deserialize
in interface ninja.leaping.configurate.objectmapping.serialize.TypeSerializer<Text>
ninja.leaping.configurate.objectmapping.ObjectMappingException
public void serialize(TypeToken<?> type, Text obj, ninja.leaping.configurate.ConfigurationNode value) throws ninja.leaping.configurate.objectmapping.ObjectMappingException
serialize
in interface ninja.leaping.configurate.objectmapping.serialize.TypeSerializer<Text>
ninja.leaping.configurate.objectmapping.ObjectMappingException
protected Optional<Text> buildContent(DataView container) throws InvalidDataException
AbstractDataBuilder
AbstractDataBuilder.supportedVersion
variant of the intended
DataSerializable
, such that all content upgrades have already
been handled by AbstractDataBuilder.build(DataView)
. This otherwise follows the
same contract as DataBuilder.build(DataView)
.buildContent
in class AbstractDataBuilder<Text>
container
- The container with data to build fromInvalidDataException
- If there's issues of invalid data formats
or invalid data