public class QuerySerializer extends Object
Note: Query serialization and deserialization does not work for all possible permutations of query parts
at the moment. For instance, BooleanQuery
will not work. You should not use the QuerySerializer in
it's current guise.
Responsible for converting SearchQueries to and from their String form.
Constructor and Description |
---|
QuerySerializer(QueryFactory queryFactory)
Construct a new query serializer
|
Modifier and Type | Method and Description |
---|---|
protected static String |
escape(String s)
Escape any double-quote in a string with a backslash, and any backslash with a second
backslash.
|
static String |
queryToString(SearchQuery query)
Convert a SearchQuery into a string form that can be transported over the wire, saved, and
so on
|
SearchQuery |
stringToQuery(String s)
Convert a string-form query back into object form.
|
public QuerySerializer(QueryFactory queryFactory)
queryFactory
- the factory to convert SearchQuery string keys back into query objectspublic static String queryToString(SearchQuery query)
query
- the query to convertpublic SearchQuery stringToQuery(String s) throws InvalidQueryException
All clients of the serializer must be able to recover from both of the above circumstances safely.
s
- the string to convertInvalidQueryException
- if the string could not be converted successfullyCopyright © 2003–2018 Atlassian. All rights reserved.