Class Transformations
java.lang.Object
ninja.leaping.configurate.examples.Transformations
public class Transformations extends Object
An example of how to use transformations to migrate a configuration to a newer schema version.
It's like DFU but not hot garbage! (and probably less PhD-worthy)
-
Constructor Summary
Constructors Constructor Description Transformations() -
Method Summary
Modifier and Type Method Description static ConfigurationTransformationcreate()Create a new builder for versioned configurations.static ConfigurationTransformationinitialTransform()A transformation.static voidmain(String[] args)static <N extends ConfigurationNode>
NupdateNode(N node)Apply the transformations to a nodestatic ConfigurationTransformationzeroToOne()
-
Constructor Details
-
Transformations
public Transformations()
-
-
Method Details
-
create
Create a new builder for versioned configurations. This builder uses a field in the node (by defaultschema-version) to determine the current schema version (using -1 for no version present).- Returns:
- versioned transformation
-
initialTransform
A transformation. This one has multiple actions, and demonstrates how wildcards work- Returns:
- created transformation
-
zeroToOne
-
updateNode
Apply the transformations to a nodeThis method also prints information about the version update that occurred
- Type Parameters:
N- node type- Parameters:
node- The node to transform- Returns:
- provided node, after transformation
-
main
- Throws:
IOException
-