Package org.spongepowered.configurate
Interface ConfigurationNodeFactory<N extends ConfigurationNode>
-
- All Known Subinterfaces:
ConfigurationLoader<N>
- All Known Implementing Classes:
AbstractConfigurationLoader
,GsonConfigurationLoader
,HoconConfigurationLoader
,JacksonConfigurationLoader
,XmlConfigurationLoader
,YamlConfigurationLoader
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ConfigurationNodeFactory<N extends ConfigurationNode>
Something that can create a customized node.- Since:
- 4.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default N
createNode()
Create a new node with default options.N
createNode(ConfigurationOptions options)
Create an empty node with the provided options.default <E extends Exception>
NcreateNode(ConfigurationOptions options, CheckedConsumer<N,E> action)
Create a new node with the provided options and initialize it with the provided action.default <E extends Exception>
NcreateNode(CheckedConsumer<N,E> action)
Create a new node with default options and initialize it with the provided action.default ConfigurationOptions
defaultOptions()
Default options for the types of nodes created by this factory.default <V> Collector<V,N,N>
toListCollector(TypeToken<V> valueType)
Create a collector that appends values to a newly created node as list children.default <V> Collector<V,N,N>
toListCollector(Class<V> valueType)
Create a collector that appends values to a newly created node as list children.default <V> Collector<Map.Entry<?,V>,N,N>
toMapCollector(TypeToken<V> valueType)
Create a collector that appends values to a newly created node as map children.default <V> Collector<Map.Entry<?,V>,N,N>
toMapCollector(Class<V> valueType)
Create a collector that appends values to a newly created node as map children.
-
-
-
Method Detail
-
defaultOptions
default ConfigurationOptions defaultOptions()
Default options for the types of nodes created by this factory.All values must match what a created node will see, but some values may be determined by this factory to be non user-modifiable. These should be documented for any factory implementation.
- Returns:
- default options
- Since:
- 4.0.0
-
createNode
N createNode(ConfigurationOptions options)
Create an empty node with the provided options.Node options may be overridden if the factory enforces specific requirements on options.
- Parameters:
options
- node options- Returns:
- newly created empty node
- Since:
- 4.0.0
-
createNode
default N createNode()
Create a new node with default options.- Returns:
- newly created empty node
- Since:
- 4.0.0
-
createNode
default <E extends Exception> N createNode(CheckedConsumer<N,E> action) throws E extends Exception
Create a new node with default options and initialize it with the provided action.- Type Parameters:
E
- thrown type- Parameters:
action
- action to initialize node with- Returns:
- newly created empty node
- Throws:
E
- when thrown from inner actionE extends Exception
- Since:
- 4.0.0
-
createNode
default <E extends Exception> N createNode(ConfigurationOptions options, CheckedConsumer<N,E> action) throws E extends Exception
Create a new node with the provided options and initialize it with the provided action.Node options may be overridden if the factory enforces specific requirements on options.
- Type Parameters:
E
- thrown type- Parameters:
options
- node optionsaction
- action to initialize node with- Returns:
- newly created empty node
- Throws:
E
- when thrown from inner actionE extends Exception
- Since:
- 4.0.0
-
toMapCollector
default <V> Collector<Map.Entry<?,V>,N,N> toMapCollector(TypeToken<V> valueType)
Create a collector that appends values to a newly created node as map children.This collector does not accept values in parallel.
- Type Parameters:
V
- value type- Parameters:
valueType
- marker for value type- Returns:
- a new collector
- Since:
- 4.0.0
-
toMapCollector
default <V> Collector<Map.Entry<?,V>,N,N> toMapCollector(Class<V> valueType)
Create a collector that appends values to a newly created node as map children.This collector does not accept values in parallel.
- Type Parameters:
V
- value type- Parameters:
valueType
- marker for value type- Returns:
- a new collector
- Since:
- 4.0.0
-
toListCollector
default <V> Collector<V,N,N> toListCollector(TypeToken<V> valueType)
Create a collector that appends values to a newly created node as list children.This collector does not accept values in parallel.
- Type Parameters:
V
- value type- Parameters:
valueType
- marker for value type- Returns:
- a new collector
- Since:
- 4.0.0
-
toListCollector
default <V> Collector<V,N,N> toListCollector(Class<V> valueType)
Create a collector that appends values to a newly created node as list children.This collector does not accept values in parallel.
- Type Parameters:
V
- value type- Parameters:
valueType
- marker for value type- Returns:
- a new collector
- Since:
- 4.0.0
-
-