Class ConfigurateOps
java.lang.Object
org.spongepowered.configurate.extra.dfu.v2.ConfigurateOps
- All Implemented Interfaces:
DynamicOps<ConfigurationNode>
Implementation of DataFixerUpper's DynamicOps.
When possible, the first node's ConfigurationNode.copy()
method
will be used to create a new node to contain results. Otherwise, the provided
factory will be used. The default factory creates a
CommentedConfigurationNode
with the default TypeSerializer collection
,
but a custom factory may be provided.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptioncreateBoolean
(boolean value) createList
(Stream<ConfigurationNode> input) createString
(String value) empty()
get
(ConfigurationNode input, String key) getGeneric
(ConfigurationNode input, ConfigurationNode key) getMapValues
(ConfigurationNode input) getNumberValue
(ConfigurationNode input) getStream
(ConfigurationNode input) getStringValue
(ConfigurationNode input) Type<?>
getType
(ConfigurationNode input) static DynamicOps<ConfigurationNode>
instance()
Get the shared instance of this class, which creates new nodes using the default factory.merge
(ConfigurationNode first, ConfigurationNode second) Merge into a newly created node.mergeInto
(ConfigurationNode input, ConfigurationNode value) mergeInto
(ConfigurationNode input, ConfigurationNode key, ConfigurationNode value) remove
(ConfigurationNode input, String key) set
(ConfigurationNode input, String key, ConfigurationNode value) toString()
update
(ConfigurationNode input, String key, Function<ConfigurationNode, ConfigurationNode> function) updateGeneric
(ConfigurationNode input, ConfigurationNode wrappedKey, Function<ConfigurationNode, ConfigurationNode> function) static DynamicOps<ConfigurationNode>
withNodeFactory
(Supplier<? extends ConfigurationNode> factory) Create a new instance of the ops, with a custom node factory.static Dynamic<ConfigurationNode>
wrap
(ConfigurationNode node) Wrap a ConfigurationNode in aDynamic
instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mojang.datafixers.types.DynamicOps
cast, createByte, createByteList, createDouble, createFloat, createInt, createIntList, createLong, createLongList, createShort, emptyList, emptyMap, getByteBuffer, getIntStream, getLongStream, getNumberValue
-
Method Details
-
instance
Get the shared instance of this class, which creates new nodes using the default factory.- Returns:
- the shared instance
- Since:
- 4.0.0
-
withNodeFactory
public static DynamicOps<ConfigurationNode> withNodeFactory(Supplier<? extends ConfigurationNode> factory) Create a new instance of the ops, with a custom node factory.- Parameters:
factory
- the factory function- Returns:
- a new ops instance
- Since:
- 4.0.0
-
wrap
Wrap a ConfigurationNode in aDynamic
instance. The returned Dynamic will use the same type serializer collection as the original node for its operations.- Parameters:
node
- the node to wrap- Returns:
- a wrapped node
- Since:
- 4.0.0
-
empty
- Specified by:
empty
in interfaceDynamicOps<ConfigurationNode>
-
getType
- Specified by:
getType
in interfaceDynamicOps<ConfigurationNode>
-
getNumberValue
- Specified by:
getNumberValue
in interfaceDynamicOps<ConfigurationNode>
-
createNumeric
- Specified by:
createNumeric
in interfaceDynamicOps<ConfigurationNode>
-
createBoolean
- Specified by:
createBoolean
in interfaceDynamicOps<ConfigurationNode>
-
getStringValue
- Specified by:
getStringValue
in interfaceDynamicOps<ConfigurationNode>
-
createString
- Specified by:
createString
in interfaceDynamicOps<ConfigurationNode>
-
mergeInto
- Specified by:
mergeInto
in interfaceDynamicOps<ConfigurationNode>
-
mergeInto
public ConfigurationNode mergeInto(ConfigurationNode input, ConfigurationNode key, ConfigurationNode value) - Specified by:
mergeInto
in interfaceDynamicOps<ConfigurationNode>
-
merge
Merge into a newly created node.- Specified by:
merge
in interfaceDynamicOps<ConfigurationNode>
- Parameters:
first
- the primary nodesecond
- the second node, with values that will override those in the first node- Returns:
- a newly created node
-
getMapValues
- Specified by:
getMapValues
in interfaceDynamicOps<ConfigurationNode>
-
createMap
- Specified by:
createMap
in interfaceDynamicOps<ConfigurationNode>
-
getStream
- Specified by:
getStream
in interfaceDynamicOps<ConfigurationNode>
-
createList
- Specified by:
createList
in interfaceDynamicOps<ConfigurationNode>
-
remove
- Specified by:
remove
in interfaceDynamicOps<ConfigurationNode>
-
get
- Specified by:
get
in interfaceDynamicOps<ConfigurationNode>
-
getGeneric
- Specified by:
getGeneric
in interfaceDynamicOps<ConfigurationNode>
-
set
- Specified by:
set
in interfaceDynamicOps<ConfigurationNode>
-
update
public ConfigurationNode update(ConfigurationNode input, String key, Function<ConfigurationNode, ConfigurationNode> function) - Specified by:
update
in interfaceDynamicOps<ConfigurationNode>
-
updateGeneric
public ConfigurationNode updateGeneric(ConfigurationNode input, ConfigurationNode wrappedKey, Function<ConfigurationNode, ConfigurationNode> function) - Specified by:
updateGeneric
in interfaceDynamicOps<ConfigurationNode>
-
toString
-