Interface AttributedConfigurationNode

All Superinterfaces:
CommentedConfigurationNodeIntermediary<AttributedConfigurationNode>, ConfigurationNode, ScopedConfigurationNode<AttributedConfigurationNode>

A configuration node that can have both comments and attributes attached.
Since:
4.0.0
  • Field Details

  • Method Details

    • factory

      Create a new factory providing AttributedConfigurationNode instances.

      The returned factory will create nodes with default options and the tag name root.

      Returns:
      a new factory
      Since:
      4.0.0
    • root

      Create a new root node with the default tag name.
      Returns:
      a new empty node
      Since:
      4.0.0
    • root

      Create a new root node with default tag name and default options.

      action will be applied to the new new node.

      Type Parameters:
      E - thrown type
      Parameters:
      action - action to perform
      Returns:
      a new empty node
      Throws:
      E - when thrown from inner action
      Since:
      4.0.0
    • root

      Create a new root node with the provided tag name but default options.

      A root node is always attached, and has no parent and an empty path.

      Parameters:
      tagName - node's tag name
      Returns:
      a new empty node
      Since:
      4.0.0
    • root

      static <E extends Exception> AttributedConfigurationNode root(String tagName, CheckedConsumer<? super AttributedConfigurationNode,E> action) throws E
      Create a new root node with the provided tag name and default options.

      The node will be initialized with the action.

      A root node is always attached, and has no parent and an empty path.

      Type Parameters:
      E - thrown type
      Parameters:
      tagName - node's tag name
      action - initialization action
      Returns:
      a new empty node
      Throws:
      E - when thrown from inner action
      Since:
      4.0.0
    • root

      Create a new root node with the provided tag name and options.

      A root node is always attached, and has no parent and an empty path.

      Parameters:
      tagName - node's tag name
      options - options to apply
      Returns:
      a new empty node
      Since:
      4.0.0
    • root

      static <E extends Exception> AttributedConfigurationNode root(String tagName, ConfigurationOptions options, CheckedConsumer<? super AttributedConfigurationNode,E> action) throws E
      Create a new root node with the provided tag name, options and initializer.

      A root node is always attached, and has no parent and an empty path.

      Type Parameters:
      E - thrown type
      Parameters:
      tagName - node's tag name
      options - options to apply
      action - action to initialize the node with
      Returns:
      a new initialized node
      Throws:
      E - when thrown from inner action
      Since:
      4.0.0
    • tagName

      Gets the tag name of this node.
      Returns:
      the tag name
      Since:
      4.0.0
    • tagName

      Sets the tag name of this node.

      Will have no effect when called on nodes which are direct values of a child map, as the corresponding key is used as the tag name.

      Parameters:
      name - the name to set, cannot be null
      Returns:
      this node
      Since:
      4.0.0
    • addAttribute

      Adds an attribute to this node.
      Parameters:
      name - the name of the attribute
      value - the value of the attribute
      Returns:
      this node
      Since:
      4.0.0
    • removeAttribute

      Removes an attribute from this node.
      Parameters:
      name - the name of the attribute to remove
      Returns:
      this node
      Since:
      4.0.0
    • attributes

      Sets the attributes of this node.
      Parameters:
      attributes - the attributes to set
      Returns:
      this node
      Since:
      4.0.0
    • attributes

      Gets the attributes this node has.

      The returned map is immutable.

      Returns:
      the map of attributes
      Since:
      4.0.0
    • hasAttributes

      boolean hasAttributes()
      Gets if this node has any attributes.
      Returns:
      true if this node has any attributes
      Since:
      4.0.0
    • attribute

      @Nullable String attribute(String name)
      Gets the value of an attribute, or null if this node doesn't have the given attribute.
      Parameters:
      name - the name of the attribute to get
      Returns:
      this node
      Since:
      4.0.0