net.coderazzi.filters.parser
Class Parser
java.lang.Object
net.coderazzi.filters.parser.Parser
- All Implemented Interfaces:
- IParser
public class Parser
- extends Object
- implements IParser
Basic implementation of a IParser
, supporting only simple operators
referring to the content of a single column.
The supporter operators include:
- Comparison operators. The comparison is done on the parsed object, not
on the string representation, unless no
Format
or Comparator
is defined for the given type. For example, specifying the
text ">= 4" implies, for a column with integer types, that a
direct comparison between integers will be performed. These operators
are:
- >=
- >
- <
- <=
- <>, !: all behave the same
- Basic wildcard operators. These operators work using the string
representation of the types (using, when possible, the defined
Format
instance). Only two wildcard characters are defined: * and ?
- ~: for example ~ *vadis* will filter in all expressions including
the substring vadis
- !~: negates the previous operator
- Regular expression operator. There is only one such operator: ~~,
accepting a java regular expression.
In addition, providing no operator will behave as the operator ~
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Parser
public Parser(Format format,
Comparator classComparator,
Comparator<String> stringComparator,
boolean ignoreCase,
int modelIndex)
parseText
public RowFilter parseText(String expression)
throws ParseException
IParser
interface.
- Specified by:
parseText
in interface IParser
- Parameters:
expression
- the text to parse
- Throws:
ParseException
parseInstantText
public IParser.InstantFilter parseInstantText(String expression)
throws ParseException
IParser
interface.
- Specified by:
parseInstantText
in interface IParser
- Parameters:
expression
- the text to parse
- Returns:
- the filter plus the real expression used to create the filter
- Throws:
ParseException
stripHtml
public String stripHtml(String expression)
IParser
interface.
- Specified by:
stripHtml
in interface IParser
escape
public String escape(String expression)
IParser
interface.
- Specified by:
escape
in interface IParser