@Immutable public final class RSQLParser extends Object
RSQL is a query language for parametrized filtering of entries in RESTful APIs. It's a superset of the FIQL (Feed Item Query Language), so it can be used for parsing FIQL as well.
Grammar in EBNF notation:
input = or, EOF;
or = and, { ( "," | " or " ) , and };
and = constraint, { ( ";" | " and " ), constraint };
constraint = ( group | comparison );
group = "(", or, ")";
comparison = selector, comparator, arguments;
selector = unreserved-str;
comparator = comp-fiql | comp-alt;
comp-fiql = ( ( "=", { ALPHA } ) | "!" ), "=";
comp-alt = ( ">" | "<" ), [ "=" ];
arguments = ( "(", value, { "," , value }, ")" ) | value;
value = unreserved-str | double-quoted | single-quoted;
unreserved-str = unreserved, { unreserved }
single-quoted = "'", { all-chars - "'" }, "'";
double-quoted = '"', { all-chars - '"' }, '"';
reserved = '"' | "'" | "(" | ")" | ";" | "," | "=" | "!" | "~" | "<" | ">" | " ";
unreserved = all-chars - reserved;
all-chars = ? all unicode characters ?;
| Constructor and Description |
|---|
RSQLParser()
Creates a new instance of
RSQLParser with the default set of comparison operators. |
RSQLParser(Set<ComparisonOperator> operators)
Creates a new instance of
RSQLParser that supports only the specified comparison
operators. |
public RSQLParser()
RSQLParser with the default set of comparison operators.public RSQLParser(Set<ComparisonOperator> operators)
RSQLParser that supports only the specified comparison
operators.operators - A set of supported comparison operators. Must not be null or empty.public Node parse(String query) throws RSQLParserException
query - The query expression to parse.RSQLParserException - If some exception occurred during parsing, i.e. the
query is syntactically invalid.IllegalArgumentException - If the query is null.Copyright © 2011–2014. All rights reserved.