Package org.yamcs.utils.parser
Class Filter<T>
java.lang.Object
org.yamcs.utils.parser.Filter<T>
- Direct Known Subclasses:
EventFilter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addBinaryField
(String field, Function<T, byte[]> resolver) protected void
addBooleanField
(String field, Function<T, Boolean> resolver) protected <E extends Enum<?>>
voidaddEnumField
(String field, Class<E> enumClass, Function<T, E> resolver) protected void
addNumberField
(String field, Function<T, Number> resolver) protected void
addPrefixField
(String field, BiFunction<T, String, String> resolver) protected void
addStringField
(String field, Function<T, String> resolver) void
beforeItem
(T item) Called for each new item, before any comparisons.boolean
True if the parsed query includes at least one text search.boolean
isQueryField
(String field) True if the provided field is part of the parsed query.boolean
protected abstract boolean
matchesLiteral
(T item, String lowercaseLiteral) Implementatinos must search the provided item for the given literal in a manner that makes sense to the type of item.void
parse()
-
Constructor Details
-
Filter
-
-
Method Details
-
parse
- Throws:
ParseException
-
isQueryField
True if the provided field is part of the parsed query.This method should only be used after
parse()
is called. -
includesTextSearch
public boolean includesTextSearch()True if the parsed query includes at least one text search.This method should only be used after
parse()
is called. -
addPrefixField
-
addStringField
-
addEnumField
-
addNumberField
-
addBooleanField
-
addBinaryField
-
matches
-
beforeItem
Called for each new item, before any comparisons.The default implementation does nothing, concrete classes may override to hook any initialization logic.
-
printExpression
-
matchesLiteral
Implementatinos must search the provided item for the given literal in a manner that makes sense to the type of item. Search should be exact and case-insensitive.- Parameters:
item
- Item to matchlowercaseLiteral
- A search string. Always lowercase.
-