Class DataFixerTransformation
java.lang.Object
org.spongepowered.configurate.extra.dfu.v3.DataFixerTransformation
- All Implemented Interfaces:
ConfigurationTransformation
,ConfigurationTransformation.Versioned
public final class DataFixerTransformation
extends Object
implements ConfigurationTransformation.Versioned
A transformation that exposes a single DataFixer to a configuration in a
friendly way.
Because Configurate does not have a schema model and DFU does, this transformation works by explicitly providing a mapping between configurate node paths and DFU TypeReferences.
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.spongepowered.configurate.transformation.ConfigurationTransformation
ConfigurationTransformation.Versioned, ConfigurationTransformation.VersionedBuilder
-
Field Summary
Fields inherited from interface org.spongepowered.configurate.transformation.ConfigurationTransformation
WILDCARD_OBJECT
Fields inherited from interface org.spongepowered.configurate.transformation.ConfigurationTransformation.Versioned
VERSION_UNKNOWN
-
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(@NonNull ConfigurationNode node) Apply this transformation to a given node.Create a builder that can work with any DFU DataFixer.int
Get the latest version that nodes can be updated to.int
version
(ConfigurationNode root) Get the version from a specific configuration node, using the configured version key.Get the path the node's current version is located at.
-
Method Details
-
dfuBuilder
Create a builder that can work with any DFU DataFixer.- Returns:
- the builder
- Since:
- 4.0.0
-
apply
Description copied from interface:ConfigurationTransformation
Apply this transformation to a given node.- Specified by:
apply
in interfaceConfigurationTransformation
- Parameters:
node
- the target node- Throws:
ConfigurateException
-
version
Get the version from a specific configuration node, using the configured version key.- Specified by:
version
in interfaceConfigurationTransformation.Versioned
- Parameters:
root
- base node to query- Returns:
- version, or -1 if this node is unversioned.
-
versionKey
Description copied from interface:ConfigurationTransformation.Versioned
Get the path the node's current version is located at.- Specified by:
versionKey
in interfaceConfigurationTransformation.Versioned
- Returns:
- version path
-
latestVersion
Description copied from interface:ConfigurationTransformation.Versioned
Get the latest version that nodes can be updated to.- Specified by:
latestVersion
in interfaceConfigurationTransformation.Versioned
- Returns:
- the most recent version
-