Site hosted at byteslooser and Grasia! mirrors.


com.byteslooser.filters.parser.generic
Class FilterTextParser

java.lang.Object
  extended by com.byteslooser.filters.parser.generic.FilterTextParser
All Implemented Interfaces:
IFilterTextParser

public class FilterTextParser
extends Object
implements IFilterTextParser

Specific implementation of the IFilterTextParser interface.

Own features of this implementation includes:

Author:
Luis M Pena - byteslooser@gmail.com

Field Summary
static char AND_CHAR
           
static char CLOSE_PARENTHESIS_CHAR
           
static String DEFAULT_NULL_STRING
           
static char ESCAPE_CHAR
           
static char OPEN_PARENTHESIS_CHAR
           
static char OR_CHAR
           
static char SPACE_CHAR
           
 
Fields inherited from interface com.byteslooser.filters.parser.IFilterTextParser
NO_FILTER_POSITION
 
Constructor Summary
FilterTextParser()
          Simple contructor
FilterTextParser(IRelationalOperandFactory operandFactory)
          Constructor defining a different set of relational operands
FilterTextParser(IRelationalOperandFactory operandFactory, ITypesFactory typesFactory)
          Constructor defining a different set of relational operands and a type factory.
FilterTextParser(ITypesFactory typesFactory)
          Constructor defining a specific type factory.
 
Method Summary
 RowFilter parseText(String exp, int defaultFilterPosition)
          Parses the text, using the given default identifier.
 void setComparator(Class<?> c, Comparator<?> cmp)
          Sets a specific comparator for a given class, that should override the default Compare algorithm for the given class.
 void setIdentifiers(List<IdentifierInfo> validIdentifiers)
          Defines the identifiers, and the types and indexes associated to them
 void setIgnoreCase(boolean ignore)
          Ignores case on the conditions associated to variables with String type
 void setNullString(String nullString)
          Sets the representation of the null case, null by default.
 void setTypeBuilder(Class<?> c, ITypeBuilder parser)
          Provides the ITypeBuilder to build non basic types
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPACE_CHAR

public static final char SPACE_CHAR
See Also:
Constant Field Values

ESCAPE_CHAR

public static final char ESCAPE_CHAR
See Also:
Constant Field Values

AND_CHAR

public static final char AND_CHAR
See Also:
Constant Field Values

OR_CHAR

public static final char OR_CHAR
See Also:
Constant Field Values

OPEN_PARENTHESIS_CHAR

public static final char OPEN_PARENTHESIS_CHAR
See Also:
Constant Field Values

CLOSE_PARENTHESIS_CHAR

public static final char CLOSE_PARENTHESIS_CHAR
See Also:
Constant Field Values

DEFAULT_NULL_STRING

public static final String DEFAULT_NULL_STRING
Constructor Detail

FilterTextParser

public FilterTextParser()
Simple contructor


FilterTextParser

public FilterTextParser(IRelationalOperandFactory operandFactory)

Constructor defining a different set of relational operands

Note that the main operands: ( ) & | are hardcoded in this class, cannot be modified in the passed factory


FilterTextParser

public FilterTextParser(ITypesFactory typesFactory)
Constructor defining a specific type factory.


FilterTextParser

public FilterTextParser(IRelationalOperandFactory operandFactory,
                        ITypesFactory typesFactory)

Constructor defining a different set of relational operands and a type factory.

Note that the main operands: ( ) & | are hardcoded in this class, cannot be modified in the passed factory

Method Detail

setIgnoreCase

public void setIgnoreCase(boolean ignore)
Description copied from interface: IFilterTextParser
Ignores case on the conditions associated to variables with String type

Specified by:
setIgnoreCase in interface IFilterTextParser
See Also:
IFilterTextParser.setIgnoreCase(boolean)

setIdentifiers

public void setIdentifiers(List<IdentifierInfo> validIdentifiers)
Description copied from interface: IFilterTextParser
Defines the identifiers, and the types and indexes associated to them

Specified by:
setIdentifiers in interface IFilterTextParser
See Also:
IFilterTextParser.setIdentifiers(List)

setComparator

public void setComparator(Class<?> c,
                          Comparator<?> cmp)

Sets a specific comparator for a given class, that should override the default Compare algorithm for the given class.

If the class is not Comparable, this method should be invoked to support any comparison operator.


setTypeBuilder

public void setTypeBuilder(Class<?> c,
                           ITypeBuilder parser)
Provides the ITypeBuilder to build non basic types


parseText

public RowFilter parseText(String exp,
                           int defaultFilterPosition)
                    throws FilterTextParsingException
Description copied from interface: IFilterTextParser

Parses the text, using the given default identifier.

If the parsed expression includes conditions that specify no identifier, the default identifier is used.

Default identifier can be IFilterTextParser.NO_FILTER_POSITION, if the expression must provide them specifically

A filter supporting the interface RowFilter receives an instance of type RowFilter.Entry that can enquiry to obtain the value at a specified index; the filter position is that given index, and corresponds, in the case of a table, to the column to which this editor is associated.

Specified by:
parseText in interface IFilterTextParser
Throws:
FilterTextParsingException
See Also:
IFilterTextParser.parseText(String, int)

setNullString

public void setNullString(String nullString)
Sets the representation of the null case, null by default.