Interface TransformAction

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Represents an action to be performed that transforms a node in the configuration tree.
Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a transform action that will remove the node at a specified path.
    rename(Object newKey)
    Rename a node
    static <V> TransformAction
    set(io.leangen.geantyref.TypeToken<V> type, @Nullable V value)
    Create a transform action that will change the value of a node to one of the specified type.
    static <V> TransformAction
    set(io.leangen.geantyref.TypeToken<V> type, Supplier<@Nullable V> valueSupplier)
    Create a transform action that will change the value of a node to one of the specified type.
    static <V> TransformAction
    set(Class<V> type, Supplier<V> valueSupplier)
    Create a transform action that will change the value of a node to one of the specified type.
    Object @Nullable []
    Called at a certain path, with the node at that path.
  • Method Details

    • remove

      Create a transform action that will remove the node at a specified path.
      Returns:
      new action
      Since:
      4.0.0
    • rename

      static TransformAction rename(Object newKey)
      Rename a node

      This transformation cannot be applied to the root node.

      Parameters:
      newKey - the new key
      Returns:
      new action
      Since:
      4.0.0
    • set

      static <V> TransformAction set(io.leangen.geantyref.TypeToken<V> type, @Nullable V value)
      Create a transform action that will change the value of a node to one of the specified type.
      Type Parameters:
      V - value type
      Parameters:
      type - value type
      value - value
      Returns:
      new transformation action
      Since:
      4.0.0
    • set

      static <V> TransformAction set(io.leangen.geantyref.TypeToken<V> type, Supplier<@Nullable V> valueSupplier)
      Create a transform action that will change the value of a node to one of the specified type.
      Type Parameters:
      V - value type
      Parameters:
      type - value type
      valueSupplier - supplier returning a value on each call
      Returns:
      new transformation action
      Since:
      4.0.0
    • set

      static <V> TransformAction set(Class<V> type, Supplier<V> valueSupplier)
      Create a transform action that will change the value of a node to one of the specified type.
      Type Parameters:
      V - value type
      Parameters:
      type - value type
      valueSupplier - supplier returning a value on each call
      Returns:
      new transformation action
      Since:
      4.0.0
    • visitPath

      Object @Nullable [] visitPath(NodePath path, ConfigurationNode value) throws ConfigurateException
      Called at a certain path, with the node at that path.

      Caution: The state of the path is only guaranteed to be accurate during a run of the transform function. Use NodePath.copy() if the path's state needs to be stored.

      Parameters:
      path - the path of the given node
      value - the node at the input path. May be modified
      Returns:
      a modified path, or null if the path is to stay the same
      Throws:
      ConfigurateException
      Since:
      4.0.0