java.lang.Object
gg.xp.xivapi.filters.SearchFilters
Collection of methods useful for constructing search filters.
All objects returned by this class are immutable. They can safely be re-used without making defensive copies.
Some search filters will intelligently "collapse" - for example not(not(foo)) will collapse down to foo, and or(or(a, b), c) will collapse to or(a, b, c).
Some methods in here also have equivalents on the SearchFilter interface itself, mainly so that you can
use Groovy operator overloads seamlessly, e.g. a | b instead of or(a, b).
-
Method Summary
Modifier and TypeMethodDescriptionstatic SearchFilterand(SearchFilter... filters) Combine multiple filters in an AND fashion.static SearchFilterCombine multiple filters in an AND fashion.static SearchFilterand(List<SearchFilter> filters) Combine multiple filters in an AND fashion.static StringModifies a field name with the '[]' modifier.static SearchFilterCreate a filter using a binary operator.static SearchFilterCreate abinary(String, String, Object)filter using the '=' (equals) operator.static SearchFilterCreate abinary(String, String, Object)filter using the '>' (strictly greater than) operator.static SearchFilterCreate abinary(String, String, Object)filter using the '>=' (greater than or equal to) operator.static StringModifies a field name with the '[index]' modifier.static SearchFilterCreate a filter for a boolean value being false.static SearchFilterCreate a filter for a boolean value being true.static SearchFilterCreate abinary(String, String, Object)filter using the '<' (strictly less than) operator.static SearchFilterCreate abinary(String, String, Object)filter using the '<=' (less than or equal to) operator.static SearchFilternot(SearchFilter filter) Logically invert a filter.static SearchFilterSearch filter from a verbatim string.static SearchFilteror(SearchFilter... filters) Combine multiple filters in an OR fashion.static SearchFilterCombine multiple filters in an OR fashion.static SearchFilteror(List<SearchFilter> filters) Combine multiple filters in an OR fashion.static SearchFilterCreate abinary(String, String, Object)filter using the '~' (string contains) operator.
-
Method Details
-
of
Search filter from a verbatim string. Must already be formatted correctly and have double-quotes and backslashes already escaped, but should not be URL-escaped.- Parameters:
filterValue- The search string.- Returns:
- The search filter consisting of that literal string.
-
or
Combine multiple filters in an OR fashion.- Parameters:
filters- The raw string filters. Must already be formatted correctly minus URL escaping (seeof(String).- Returns:
- A filter representing the logical OR of the constituent filters.
-
or
Combine multiple filters in an OR fashion.- Parameters:
filters- The raw string filters. Must already be formatted correctly minus URL escaping (seeof(String).- Returns:
- A filter representing the logical OR of the constituent filters.
-
or
Combine multiple filters in an OR fashion.- Parameters:
filters- The filters.- Returns:
- A filter representing the logical OR of the constituent filters.
-
and
Combine multiple filters in an AND fashion.- Parameters:
filters- The raw string filters. Must already be formatted correctly minus URL escaping (seeof(String).- Returns:
- A filter representing the logical AND of the constituent filters.
-
and
Combine multiple filters in an AND fashion.- Parameters:
filters- The raw string filters. Must already be formatted correctly minus URL escaping (seeof(String).- Returns:
- A filter representing the logical AND of the constituent filters.
-
and
Combine multiple filters in an AND fashion.- Parameters:
filters- The raw string filters.- Returns:
- A filter representing the logical AND of the constituent filters.
-
not
Logically invert a filter.- Parameters:
filter- The filter to invert.- Returns:
- The filter representing the logical inverse of the input.
-
binary
Create a filter using a binary operator.- Parameters:
field- The field on which to operate.operator- The operator to apply.value- The value. String values will be quoted and escaped automatically.- Returns:
- The binary filter.
-
eq
Create abinary(String, String, Object)filter using the '=' (equals) operator.- Parameters:
field- The field.value- The expected value.- Returns:
- The filter.
-
isTrue
Create a filter for a boolean value being true.- Parameters:
field- The field on which to expect truth.- Returns:
- The filter.
-
isFalse
Create a filter for a boolean value being false.- Parameters:
field- The field on which to expect falsity.- Returns:
- The filter.
-
gte
Create abinary(String, String, Object)filter using the '>=' (greater than or equal to) operator.- Parameters:
field- The field.value- The comparison value.- Returns:
- The filter.
-
lte
Create abinary(String, String, Object)filter using the '<=' (less than or equal to) operator.- Parameters:
field- The field.value- The comparison value.- Returns:
- The filter.
-
gt
Create abinary(String, String, Object)filter using the '>' (strictly greater than) operator.- Parameters:
field- The field.value- The comparison value.- Returns:
- The filter.
-
lt
Create abinary(String, String, Object)filter using the '<' (strictly less than) operator.- Parameters:
field- The field.value- The comparison value.- Returns:
- The filter.
-
strPart
Create abinary(String, String, Object)filter using the '~' (string contains) operator.- Parameters:
field- The field.value- The partial string to search for.- Returns:
- The filter.
-
any
Modifies a field name with the '[]' modifier. This should be used with an array field, to expect that any index matches the filter to which this is applied.- Parameters:
field- The field to match.- Returns:
- A String representing the field name with the "any index" modifier applied.
-
index
Modifies a field name with the '[index]' modifier. This should be used with an array field, to expect that a specific index matches the filter to which this is applied.- Parameters:
field- The field to match.- Returns:
- A String representing the field name with the "specific index" modifier applied.
-