Class DataFixerTransformation
- java.lang.Object
-
- org.spongepowered.configurate.extra.dfu.v4.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 Classes Modifier and Type Class Description static class
DataFixerTransformation.Builder
Builder forDataFixerTransformation
.-
Nested 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(@NonNull ConfigurationNode node)
Apply this transformation to a given node.static DataFixerTransformation.Builder
dfuBuilder()
Create a builder that can work with any DFU DataFixer.int
latestVersion()
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.NodePath
versionKey()
Get the path the node's current version is located at.
-
-
-
Method Detail
-
dfuBuilder
public static DataFixerTransformation.Builder dfuBuilder()
Create a builder that can work with any DFU DataFixer.- Returns:
- the builder
- Since:
- 4.0.0
-
apply
public void apply(@NonNull ConfigurationNode node) throws ConfigurateException
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
public int version(ConfigurationNode root)
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
public NodePath 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
public int 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
-
-