Interface ConfigurationNodeFactory<N extends ConfigurationNode>

    • 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 java.lang.Exception>
      N
      createNode​(ConfigurationOptions options, CheckedConsumer<N,​E> action)
      Create a new node with the provided options and initialize it with the provided action.
      default <E extends java.lang.Exception>
      N
      createNode​(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> java.util.stream.Collector<V,​N,​N> toListCollector​(io.leangen.geantyref.TypeToken<V> valueType)
      Create a collector that appends values to a newly created node as list children.
      default <V> java.util.stream.Collector<V,​N,​N> toListCollector​(java.lang.Class<V> valueType)
      Create a collector that appends values to a newly created node as list children.
      default <V> java.util.stream.Collector<java.util.Map.Entry<?,​V>,​N,​N> toMapCollector​(io.leangen.geantyref.TypeToken<V> valueType)
      Create a collector that appends values to a newly created node as map children.
      default <V> java.util.stream.Collector<java.util.Map.Entry<?,​V>,​N,​N> toMapCollector​(java.lang.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 java.lang.Exception> N createNode​(CheckedConsumer<N,​E> action)
                                                      throws E extends java.lang.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 action
        E extends java.lang.Exception
        Since:
        4.0.0
      • createNode

        default <E extends java.lang.Exception> N createNode​(ConfigurationOptions options,
                                                             CheckedConsumer<N,​E> action)
                                                      throws E extends java.lang.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 options
        action - action to initialize node with
        Returns:
        newly created empty node
        Throws:
        E - when thrown from inner action
        E extends java.lang.Exception
        Since:
        4.0.0
      • toMapCollector

        default <V> java.util.stream.Collector<java.util.Map.Entry<?,​V>,​N,​NtoMapCollector​(io.leangen.geantyref.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> java.util.stream.Collector<java.util.Map.Entry<?,​V>,​N,​NtoMapCollector​(java.lang.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> java.util.stream.Collector<V,​N,​NtoListCollector​(io.leangen.geantyref.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> java.util.stream.Collector<V,​N,​NtoListCollector​(java.lang.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