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 StringasString(char separator)Gets this query as a string separated by the given separator character.StringasString(String separator)Gets this query as a string separated by the given separator.booleanequals(Object obj)voidforEach(Consumer<? super String> action)inthashCode()Iterator<String>iterator()DataQuerylast()Gets the last entry of thisDataQuery.static DataQueryof()Gets an emptyDataQuery.static DataQueryof(char separator, String path)Constructs a query using the given separator character and path.static DataQueryof(String... parts)Constructs a query using the given parts.static DataQueryof(List<String> parts)Constructs a query using the given parts.List<String>parts()Gets the parts that make up this query.DataQuerypop()Returns aDataQuerywhere the last node is "popped" off.DataQuerypopFirst()Returns aDataQuerywhere the first node is "popped" off.List<DataQuery>queryParts()Returns the parts of this query as individual queries.Spliterator<String>spliterator()DataQuerythen(String that)Returns a new query that is made up of this query's parts followed by the given query.DataQuerythen(DataQuery that)Returns a new query that is made up of this query's parts followed by the given query's parts.StringtoString()
-
-
-
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 aDataQuerywhere 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 aDataQuerywhere 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:
spliteratorin interfaceIterable<String>
-
-