Package org.spongepowered.configurate
Interface NodePath
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Object[]
array()
Returns a copy of the original path array.NodePath
copy()
Create a new node path with the same data as this path.Object
get(int i)
Gets a specific element from the path array.Iterator<Object>
iterator()
Returns an iterator over the path.static NodePath
of(Object[] path)
Create a node path reference.static NodePath
of(Collection<?> path)
Create a node path reference.static NodePath
path()
Get an empty node path.static NodePath
path(Object... elements)
Create a node path reference.int
size()
Gets the length of the path.NodePath
with(int index, Object value)
Create a new path with the value atindex
replaced withvalue
.NodePath
withAppendedChild(Object childKey)
Create a new path with the provided element appended to the end.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
of
static NodePath of(Object[] path)
Create a node path reference.- Parameters:
path
- the path to reference. The provided array will be copied.- Returns:
- the path instance
- Since:
- 4.0.0
-
of
static NodePath of(Collection<?> path)
Create a node path reference.- Parameters:
path
- a collection containing elements of the path to reference- Returns:
- the path instance
- Since:
- 4.0.0
-
path
static NodePath path(Object... elements)
Create a node path reference.This overload takes varargs, and is designed to be imported statically to create paths.
- Parameters:
elements
- the path to reference. The provided array will be copied.- Returns:
- the path instance
- Since:
- 4.0.0
-
path
static NodePath path()
Get an empty node path. This refers to the root node.- Returns:
- the empty path
- Since:
- 4.0.0
-
get
Object get(int i)
Gets a specific element from the path array.- Parameters:
i
- the index to get- Returns:
- object at the index
- Since:
- 4.0.0
-
size
int size()
Gets the length of the path.- Returns:
- length of the path array
- Since:
- 4.0.0
-
array
Object[] array()
Returns a copy of the original path array.- Returns:
- the copied array
- Since:
- 4.0.0
-
withAppendedChild
NodePath withAppendedChild(Object childKey)
Create a new path with the provided element appended to the end.- Parameters:
childKey
- the new key to append- Returns:
- a new path object reflecting the extended path
- Since:
- 4.0.0
-
with
NodePath with(int index, Object value) throws IndexOutOfBoundsException
Create a new path with the value atindex
replaced withvalue
.- Parameters:
index
- position to changevalue
- value to insert- Returns:
- new path object with changed value
- Throws:
IndexOutOfBoundsException
- if index < 0 or ≥ size()- Since:
- 4.0.0
-
-