Class DataQuery
- java.lang.Object
-
- org.spongepowered.api.data.persistence.DataQuery
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
asString(char separator)
Gets this query as a string separated by the given separator character.String
asString(String separator)
Gets this query as a string separated by the given separator.boolean
equals(Object obj)
void
forEach(Consumer<? super String> action)
int
hashCode()
Iterator<String>
iterator()
DataQuery
last()
Gets the last entry of thisDataQuery
.static DataQuery
of()
Gets an emptyDataQuery
.static DataQuery
of(char separator, String path)
Constructs a query using the given separator character and path.static DataQuery
of(String... parts)
Constructs a query using the given parts.static DataQuery
of(List<String> parts)
Constructs a query using the given parts.List<String>
parts()
Gets the parts that make up this query.DataQuery
pop()
Returns aDataQuery
where the last node is "popped" off.DataQuery
popFirst()
Returns aDataQuery
where the first node is "popped" off.List<DataQuery>
queryParts()
Returns the parts of this query as individual queries.Spliterator<String>
spliterator()
DataQuery
then(String that)
Returns a new query that is made up of this query's parts followed by the given query.DataQuery
then(DataQuery that)
Returns a new query that is made up of this query's parts followed by the given query's parts.String
toString()
-
-
-
Method Detail
-
of
public static DataQuery of()
Gets an emptyDataQuery
. This query is constant and never changes and therefor can be called multiple times returning the same instance.- Returns:
- An empty data query
-
of
public static DataQuery of(char separator, String path)
Constructs a query using the given separator character and path.As an example,
new DataQuery('/', "a/b/c")
andnew DataQuery('.', "a.b.c")
represent the same path but are constructed using different separators.- Parameters:
separator
- The separatorpath
- The path- Returns:
- The newly constructed
DataQuery
-
of
public static DataQuery of(String... parts)
Constructs a query using the given parts.- Parameters:
parts
- The parts- Returns:
- The newly constructed
DataQuery
-
of
public static DataQuery of(List<String> parts)
Constructs a query using the given parts.- Parameters:
parts
- The parts- Returns:
- The newly constructed
DataQuery
-
parts
public List<String> parts()
Gets the parts that make up this query. The returned list is immutable.- Returns:
- The parts of this query
-
then
public DataQuery then(DataQuery that)
Returns a new query that is made up of this query's parts followed by the given query's parts.- Parameters:
that
- The given query to follow this one- Returns:
- The constructed query
-
then
public DataQuery then(String that)
Returns a new query that is made up of this query's parts followed by the given query.- Parameters:
that
- The given query to follow this one- Returns:
- The constructed query
-
queryParts
public List<DataQuery> queryParts()
Returns the parts of this query as individual queries. The returned list is immutable.- Returns:
- The constructed queries
-
pop
public DataQuery pop()
Returns aDataQuery
where the last node is "popped" off. If this query is already the top level query, then theof()
is returned.- Returns:
- The next level query
-
popFirst
public DataQuery popFirst()
Returns aDataQuery
where the first node is "popped" off. If this query is already the top level query, then theof()
is returned.- Returns:
- The next level query
-
last
public DataQuery last()
Gets the last entry of thisDataQuery
. If this query is a single entry query or an empty query, it returns itself.- Returns:
- The last entry as a data query, if not already last
-
asString
public String asString(String separator)
Gets this query as a string separated by the given separator.- Parameters:
separator
- The separator- Returns:
- This query as a string
-
asString
public String asString(char separator)
Gets this query as a string separated by the given separator character.- Parameters:
separator
- The separator- Returns:
- This query as a string
-
spliterator
public Spliterator<String> spliterator()
- Specified by:
spliterator
in interfaceIterable<String>
-
-