Class FilterCriterion<T>

  • Type Parameters:
    T - target type for deserializing operand value

    public class FilterCriterion<T>
    extends Object
    Filter Criterion Container.A filter criterion is a composition of
    • an expression (e.g. field name) being target of filter operation
    • a filter operation (operator)
    • one ore more filter values to be used for filtering operation (operand(s))
    • a flag to indicate if the expression is native and has to be used unchanged in the underlying backend system (e.g. mapping Java member names to database column names vs. no mapping needed because expression is already backend/database specific)
    References:
    See Also:
    An example application using Spring boot MVC, Spring Data JPA with the ability to do filter, pagination and sorting.
    • Constructor Detail

      • FilterCriterion

        public FilterCriterion()
      • FilterCriterion

        public FilterCriterion​(String expression,
                               boolean nativeExpression,
                               FilterOperation operation,
                               Object value,
                               Comparable<?> minValue,
                               Comparable<?> maxValue,
                               Collection<?> values)
        Constructor for a filter criterion.
        Parameters:
        expression - expression the criterion should be used for
        nativeExpression - a flag to indicate if the expression is native and has to be used unchanged/as is in underlying backend system (e.g. mapping Java member names to database column names; if "true" no mapping needed (should not be exposed to public modifications, just use internally for security reasons) because expression is already e.g. backend/database specific)
        operation - operation of criterion
        value - operand of criterion
        minValue - minimum value of between operation
        maxValue - maximum value of between operation
        values - operand(s) of criterion
      • FilterCriterion

        public FilterCriterion​(String expression,
                               FilterOperation operation,
                               Object value,
                               Comparable<?> minValue,
                               Comparable<?> maxValue,
                               Collection<?> values)
        Constructor for a non-native expression filter criterion.
        Parameters:
        expression - expression the criterion should be used for
        operation - operation of criterion
        value - operand of criterion
        minValue - minimum value of between operation
        maxValue - maximum value of between operation
        values - operand(s) of criterion
      • FilterCriterion

        public FilterCriterion​(String expression,
                               FilterOperation operation,
                               Object value)
        Constructor for single value Filter Criterion.
        Parameters:
        expression - expression the criterion should be used for
        operation - operation of criterion
        value - operand of criterion
      • FilterCriterion

        public FilterCriterion​(String expression,
                               boolean nativeExpression,
                               FilterOperation operation,
                               Object value)
        Constructor for single value Filter Criterion.
        Parameters:
        expression - expression the criterion should be used for
        nativeExpression - true if expression is native (to be handled "as is")
        operation - operation of criterion
        value - operand of criterion
      • FilterCriterion

        public FilterCriterion​(String expression,
                               FilterOperation operation)
        Constructor for no value Filter Criterion.
        Parameters:
        expression - expression the criterion should be used for
        operation - operation of criterion
      • FilterCriterion

        public FilterCriterion​(String expression,
                               boolean nativeExpression,
                               FilterOperation operation)
        Constructor for no value Filter Criterion.
        Parameters:
        expression - expression the criterion should be used for
        nativeExpression - true if expression is native (to be handled "as is")
        operation - operation of criterion
      • FilterCriterion

        public FilterCriterion​(FilterCriterion other)
        Copy constructor
        Parameters:
        other -
    • Method Detail

      • getExpression

        public String getExpression()
        Returns:
        expression being target of filter operation
      • getValue

        public Object getValue()
        Returns:
        value of a single value operation
      • getValues

        public Collection<?> getValues()
        Returns:
        values of a multi value operation of field type T
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • init

        protected void init()
      • isNativeExpression

        public boolean isNativeExpression()
      • setExpression

        public void setExpression​(String expression)
      • setFieldName

        @Deprecated
        public void setFieldName​(String expression)
        Deprecated.
        use setExpression(String expression) instead
        Parameters:
        expression - criterion expression
      • setNativeExpression

        public void setNativeExpression​(boolean nativeExpression)