Package org.spongepowered.configurate
Interface AttributedConfigurationNode
-
- All Superinterfaces:
CommentedConfigurationNodeIntermediary<AttributedConfigurationNode>
,ConfigurationNode
,ScopedConfigurationNode<AttributedConfigurationNode>
public interface AttributedConfigurationNode extends CommentedConfigurationNodeIntermediary<AttributedConfigurationNode>
A configuration node that can have both comments and attributes attached.- Since:
- 4.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TAG_ROOT
The default tag name for a root node.-
Fields inherited from interface org.spongepowered.configurate.ConfigurationNode
NUMBER_DEF
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description AttributedConfigurationNode
addAttribute(java.lang.String name, java.lang.String value)
Adds an attribute to this node.@Nullable java.lang.String
attribute(java.lang.String name)
Gets the value of an attribute, or null if this node doesn't have the given attribute.java.util.Map<java.lang.String,java.lang.String>
attributes()
Gets the attributes this node has.AttributedConfigurationNode
attributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Sets the attributes of this node.static ConfigurationNodeFactory<AttributedConfigurationNode>
factory()
Create a new factory providingAttributedConfigurationNode
instances.boolean
hasAttributes()
Gets if this node has any attributes.AttributedConfigurationNode
removeAttribute(java.lang.String name)
Removes an attribute from this node.static AttributedConfigurationNode
root()
Create a new root node with thedefault
tag name.static AttributedConfigurationNode
root(java.lang.String tagName)
Create a new root node with the provided tag name but default options.static AttributedConfigurationNode
root(java.lang.String tagName, ConfigurationOptions options)
Create a new root node with the provided tag name and options.static <E extends java.lang.Exception>
AttributedConfigurationNoderoot(java.lang.String tagName, ConfigurationOptions options, CheckedConsumer<? super AttributedConfigurationNode,E> action)
Create a new root node with the provided tag name, options and initializer.static <E extends java.lang.Exception>
AttributedConfigurationNoderoot(java.lang.String tagName, CheckedConsumer<? super AttributedConfigurationNode,E> action)
Create a new root node with the provided tag name and default options.static <E extends java.lang.Exception>
AttributedConfigurationNoderoot(CheckedConsumer<? super AttributedConfigurationNode,E> action)
Create a new root node withdefault
tag name and default options.java.lang.String
tagName()
Gets the tag name of this node.AttributedConfigurationNode
tagName(java.lang.String name)
Sets the tag name of this node.-
Methods inherited from interface org.spongepowered.configurate.CommentedConfigurationNodeIntermediary
comment, comment, commentIfAbsent
-
Methods inherited from interface org.spongepowered.configurate.ConfigurationNode
empty, get, get, get, get, get, get, get, get, get, get, get, get, getBoolean, getBoolean, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getList, getList, getList, getList, getList, getList, getLong, getLong, getString, getString, hasChild, hasChild, hint, isList, isMap, isNull, key, options, ownHint, ownHints, path, raw, rawScalar, removeChild, require, require, require, virtual, visit, visit, visit, visit
-
Methods inherited from interface org.spongepowered.configurate.ScopedConfigurationNode
act, appendListNode, childrenList, childrenMap, copy, from, hint, mergeFrom, node, node, parent, raw, self, set, set, set, set, set, setList, setList, toListCollector, toListCollector, toMapCollector, toMapCollector
-
-
-
-
Field Detail
-
TAG_ROOT
static final java.lang.String TAG_ROOT
The default tag name for a root node.- See Also:
- Constant Field Values
-
-
Method Detail
-
factory
static ConfigurationNodeFactory<AttributedConfigurationNode> factory()
Create a new factory providingAttributedConfigurationNode
instances.The returned factory will create nodes with default options and the tag name
root
.- Returns:
- a new factory
- Since:
- 4.0.0
-
root
static AttributedConfigurationNode root()
Create a new root node with thedefault
tag name.- Returns:
- a new empty node
- Since:
- 4.0.0
-
root
static <E extends java.lang.Exception> AttributedConfigurationNode root(CheckedConsumer<? super AttributedConfigurationNode,E> action) throws E extends java.lang.Exception
Create a new root node withdefault
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 actionE extends java.lang.Exception
- Since:
- 4.0.0
-
root
static AttributedConfigurationNode root(java.lang.String tagName)
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 java.lang.Exception> AttributedConfigurationNode root(java.lang.String tagName, CheckedConsumer<? super AttributedConfigurationNode,E> action) throws E extends java.lang.Exception
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 nameaction
- initialization action- Returns:
- a new empty node
- Throws:
E
- when thrown from inner actionE extends java.lang.Exception
- Since:
- 4.0.0
-
root
static AttributedConfigurationNode root(java.lang.String tagName, ConfigurationOptions options)
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 nameoptions
- options to apply- Returns:
- a new empty node
- Since:
- 4.0.0
-
root
static <E extends java.lang.Exception> AttributedConfigurationNode root(java.lang.String tagName, ConfigurationOptions options, CheckedConsumer<? super AttributedConfigurationNode,E> action) throws E extends java.lang.Exception
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 nameoptions
- options to applyaction
- action to initialize the node with- Returns:
- a new initialized node
- Throws:
E
- when thrown from inner actionE extends java.lang.Exception
- Since:
- 4.0.0
-
tagName
java.lang.String tagName()
Gets the tag name of this node.- Returns:
- the tag name
- Since:
- 4.0.0
-
tagName
AttributedConfigurationNode tagName(java.lang.String name)
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
AttributedConfigurationNode addAttribute(java.lang.String name, java.lang.String value)
Adds an attribute to this node.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- this node
- Since:
- 4.0.0
-
removeAttribute
AttributedConfigurationNode removeAttribute(java.lang.String name)
Removes an attribute from this node.- Parameters:
name
- the name of the attribute to remove- Returns:
- this node
- Since:
- 4.0.0
-
attributes
AttributedConfigurationNode attributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Sets the attributes of this node.- Parameters:
attributes
- the attributes to set- Returns:
- this node
- Since:
- 4.0.0
-
attributes
java.util.Map<java.lang.String,java.lang.String> 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 java.lang.String attribute(java.lang.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
-
-