Class ConfigurateOps
- java.lang.Object
-
- org.spongepowered.configurate.extra.dfu.v2.ConfigurateOps
-
- All Implemented Interfaces:
DynamicOps<ConfigurationNode>
public final class ConfigurateOps extends java.lang.Object implements 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 aCommentedConfigurationNode
with thedefault TypeSerializer collection
, but a custom factory may be provided.- Since:
- 4.0.0
-
-
Method Summary
-
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 Detail
-
instance
public static DynamicOps<ConfigurationNode> 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(java.util.function.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
public static Dynamic<ConfigurationNode> wrap(ConfigurationNode node)
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
public ConfigurationNode empty()
- Specified by:
empty
in interfaceDynamicOps<ConfigurationNode>
-
getType
public Type<?> getType(ConfigurationNode input)
- Specified by:
getType
in interfaceDynamicOps<ConfigurationNode>
-
getNumberValue
public java.util.Optional<java.lang.Number> getNumberValue(ConfigurationNode input)
- Specified by:
getNumberValue
in interfaceDynamicOps<ConfigurationNode>
-
createNumeric
public ConfigurationNode createNumeric(java.lang.Number i)
- Specified by:
createNumeric
in interfaceDynamicOps<ConfigurationNode>
-
createBoolean
public ConfigurationNode createBoolean(boolean value)
- Specified by:
createBoolean
in interfaceDynamicOps<ConfigurationNode>
-
getStringValue
public java.util.Optional<java.lang.String> getStringValue(ConfigurationNode input)
- Specified by:
getStringValue
in interfaceDynamicOps<ConfigurationNode>
-
createString
public ConfigurationNode createString(java.lang.String value)
- Specified by:
createString
in interfaceDynamicOps<ConfigurationNode>
-
mergeInto
public ConfigurationNode mergeInto(ConfigurationNode input, ConfigurationNode value)
- Specified by:
mergeInto
in interfaceDynamicOps<ConfigurationNode>
-
mergeInto
public ConfigurationNode mergeInto(ConfigurationNode input, ConfigurationNode key, ConfigurationNode value)
- Specified by:
mergeInto
in interfaceDynamicOps<ConfigurationNode>
-
merge
public ConfigurationNode merge(ConfigurationNode first, ConfigurationNode second)
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
public java.util.Optional<java.util.Map<ConfigurationNode,ConfigurationNode>> getMapValues(ConfigurationNode input)
- Specified by:
getMapValues
in interfaceDynamicOps<ConfigurationNode>
-
createMap
public ConfigurationNode createMap(java.util.Map<ConfigurationNode,ConfigurationNode> map)
- Specified by:
createMap
in interfaceDynamicOps<ConfigurationNode>
-
getStream
public java.util.Optional<java.util.stream.Stream<ConfigurationNode>> getStream(ConfigurationNode input)
- Specified by:
getStream
in interfaceDynamicOps<ConfigurationNode>
-
createList
public ConfigurationNode createList(java.util.stream.Stream<ConfigurationNode> input)
- Specified by:
createList
in interfaceDynamicOps<ConfigurationNode>
-
remove
public ConfigurationNode remove(ConfigurationNode input, java.lang.String key)
- Specified by:
remove
in interfaceDynamicOps<ConfigurationNode>
-
get
public java.util.Optional<ConfigurationNode> get(ConfigurationNode input, java.lang.String key)
- Specified by:
get
in interfaceDynamicOps<ConfigurationNode>
-
getGeneric
public java.util.Optional<ConfigurationNode> getGeneric(ConfigurationNode input, ConfigurationNode key)
- Specified by:
getGeneric
in interfaceDynamicOps<ConfigurationNode>
-
set
public ConfigurationNode set(ConfigurationNode input, java.lang.String key, ConfigurationNode value)
- Specified by:
set
in interfaceDynamicOps<ConfigurationNode>
-
update
public ConfigurationNode update(ConfigurationNode input, java.lang.String key, java.util.function.Function<ConfigurationNode,ConfigurationNode> function)
- Specified by:
update
in interfaceDynamicOps<ConfigurationNode>
-
updateGeneric
public ConfigurationNode updateGeneric(ConfigurationNode input, ConfigurationNode wrappedKey, java.util.function.Function<ConfigurationNode,ConfigurationNode> function)
- Specified by:
updateGeneric
in interfaceDynamicOps<ConfigurationNode>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-