Class TableRowsFilter


  • public class TableRowsFilter
    extends Object
    Filter of table rows by applying a FieldValueComparator predicate on them.
    Author:
    mmoquillon
    • Field Detail

      • FIELD_NONE

        public static final String FIELD_NONE
        Default value when no comparator or no field name are set.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TableRowsFilter

        public TableRowsFilter()
    • Method Detail

      • getAllComparators

        public static Set<String> getAllComparators()
        Gets the symbol of all of the comparators supported by this filter.
        Returns:
        a set of comparator symbols.
      • setComparator

        public void setComparator​(String comparatorSymbol)
        Sets the current comparator to use in the filtering of the SQL query result.
        Parameters:
        comparatorSymbol - the symbol of a supported comparator.
      • setFieldName

        public void setFieldName​(String fieldName,
                                 Class<?> fieldType)
        Sets the name of the field, and its concrete type, in each table row of a result to filter.
        Parameters:
        fieldName - the name of a field in the table rows of a SQL query result.
        fieldType - the concrete type of the field.
      • setFieldValue

        public void setFieldValue​(String fieldValue)
        Sets the value with which a field of all of the table row will be filtered.
        Parameters:
        fieldValue - the value with which the field of each table row will be compared.
      • getComparator

        public String getComparator()
        Gets the symbol of the comparator used in the filtering of the SQL query result.
        Returns:
        the symbol of a supported comparator.
      • getFieldName

        public String getFieldName()
        Gets the name of the field to filter.
        Returns:
        a field name.
      • getFieldValue

        public String getFieldValue()
        Gets the reference field value, that is the value with which the field of all table rows in the result will be filtered.
        Returns:
        the value used in the filtering as a String instance.
      • clear

        public void clear()
        Clears all the filtering parameters used by this filter.
      • filter

        public List<TableRow> filter​(List<TableRow> rows)
        Filters the specified table rows by applying the underlying filtering parameters that were set by the setters.
        Parameters:
        rows - the rows to filter.
        Returns:
        a list with all the table rows filtered according to the underlying filtering parameters.