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 aDynamicinstance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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 aDynamicinstance. 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:
emptyin interfaceDynamicOps<ConfigurationNode>
-
getType
- Specified by:
getTypein interfaceDynamicOps<ConfigurationNode>
-
getNumberValue
- Specified by:
getNumberValuein interfaceDynamicOps<ConfigurationNode>
-
createNumeric
- Specified by:
createNumericin interfaceDynamicOps<ConfigurationNode>
-
createBoolean
- Specified by:
createBooleanin interfaceDynamicOps<ConfigurationNode>
-
getStringValue
- Specified by:
getStringValuein interfaceDynamicOps<ConfigurationNode>
-
createString
- Specified by:
createStringin interfaceDynamicOps<ConfigurationNode>
-
mergeInto
- Specified by:
mergeIntoin interfaceDynamicOps<ConfigurationNode>
-
mergeInto
public ConfigurationNode mergeInto(ConfigurationNode input, ConfigurationNode key, ConfigurationNode value) - Specified by:
mergeIntoin interfaceDynamicOps<ConfigurationNode>
-
merge
Merge into a newly created node.- Specified by:
mergein 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:
getMapValuesin interfaceDynamicOps<ConfigurationNode>
-
createMap
- Specified by:
createMapin interfaceDynamicOps<ConfigurationNode>
-
getStream
- Specified by:
getStreamin interfaceDynamicOps<ConfigurationNode>
-
createList
- Specified by:
createListin interfaceDynamicOps<ConfigurationNode>
-
remove
- Specified by:
removein interfaceDynamicOps<ConfigurationNode>
-
get
- Specified by:
getin interfaceDynamicOps<ConfigurationNode>
-
getGeneric
- Specified by:
getGenericin interfaceDynamicOps<ConfigurationNode>
-
set
- Specified by:
setin interfaceDynamicOps<ConfigurationNode>
-
update
public ConfigurationNode update(ConfigurationNode input, String key, Function<ConfigurationNode, ConfigurationNode> function) - Specified by:
updatein interfaceDynamicOps<ConfigurationNode>
-
updateGeneric
public ConfigurationNode updateGeneric(ConfigurationNode input, ConfigurationNode wrappedKey, Function<ConfigurationNode, ConfigurationNode> function) - Specified by:
updateGenericin interfaceDynamicOps<ConfigurationNode>
-
toString
-