public final class DataQuery extends Object
Modifier and Type | Method and 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) |
List<String> |
getParts()
Gets the parts that make up this query.
|
List<DataQuery> |
getQueryParts()
Returns the parts of this query as individual queries.
|
int |
hashCode() |
DataQuery |
last()
Gets the last entry of this
DataQuery . |
static DataQuery |
of()
Gets an empty
DataQuery . |
static DataQuery |
of(char separator,
String path)
Constructs a query using the given separator character and path.
|
static DataQuery |
of(List<String> parts)
Constructs a query using the given parts.
|
static DataQuery |
of(String... parts)
Constructs a query using the given parts.
|
DataQuery |
pop()
Returns a
DataQuery where the last node is "popped" off. |
DataQuery |
popFirst()
Returns a
DataQuery where the first node is "popped" off. |
DataQuery |
then(DataQuery that)
Returns a new query that is made up of this query's parts followed by the
given query's parts.
|
DataQuery |
then(String that)
Returns a new query that is made up of this query's parts followed by the
given query.
|
String |
toString() |
public static DataQuery of()
DataQuery
. This query is constant and never
changes and therefor can be called multiple times returning the
same instance.public static DataQuery of(char separator, String path)
As an example, new DataQuery('/', "a/b/c")
and
new DataQuery('.', "a.b.c")
represent the same path but are
constructed using different separators.
separator
- The separatorpath
- The pathDataQuery
public static DataQuery of(String... parts)
parts
- The partsDataQuery
public static DataQuery of(List<String> parts)
parts
- The partsDataQuery
public List<String> getParts()
public DataQuery then(DataQuery that)
that
- The given query to follow this onepublic DataQuery then(String that)
that
- The given query to follow this onepublic List<DataQuery> getQueryParts()
public DataQuery pop()
DataQuery
where the last node is "popped" off. If this
query is already the top level query, then the of()
is
returned.public DataQuery popFirst()
DataQuery
where the first node is "popped" off. If this
query is already the top level query, then the of()
is
returned.public DataQuery last()
DataQuery
. If this query is
a single entry query or an empty query, it returns itself.public String asString(String separator)
separator
- The separatorpublic String asString(char separator)
separator
- The separator