Class Filter<T>

java.lang.Object
com.appiancorp.common.query.Filter<T>
Type Parameters:
T - Type of value
All Implemented Interfaces:
Criteria, com.appiancorp.common.query.ReadOnlyFilter, Serializable
Direct Known Subclasses:
GenericFilter, TypedValueFilter

@GwtCompatible @MappedSuperclass public abstract class Filter<T> extends Object implements com.appiancorp.common.query.ReadOnlyFilter

Bean representing a configured Filter on a column.

The column can be filtered either by a value or an expression, which evaluated value will be use to filter.

See Also:
  • Field Details

  • Constructor Details

    • Filter

      protected Filter()
      Initializes a newly created Filter
    • Filter

      protected Filter(String field, FilterOperator operator, String valueExpression)
      Constructs a new Filter where its constraint is given as an expression.

      The constructor that takes T value is preferred over this constructor because evaluation of an expression to obtain the value is unnecessary except in cases of deferred evaluation, which are not applicable to cases of constructing a Filter for plug-ins.

      Parameters:
      field - column or alias name
      operator - filter type define as FilterOperator
      valueExpression - expression representing the object use to constraint the column or alias
      See Also:
    • Filter

      protected Filter(String field, FilterOperator operator, T value)
      Constructs a new Filter where its constraint is given as an object value.
      Parameters:
      field - column or alias name
      operator - filter type define as FilterOperator
      value - object use to constraint the column or alias
  • Method Details

    • getValue

      public abstract T getValue()
      Returns the value used as a constraint on the column or alias
      Returns:
      the value constraint
    • setValue

      protected abstract void setValue(T value)
    • getValueReadOnly

      public com.appiancorp.core.expr.portable.PortableTypedValue getValueReadOnly()
      Specified by:
      getValueReadOnly in interface com.appiancorp.common.query.ReadOnlyFilter
    • getField

      public String getField()
      Returns the column or alias name
      Specified by:
      getField in interface com.appiancorp.common.query.ReadOnlyFilter
      Returns:
      the column or alias name
    • getOperator

      public FilterOperator getOperator()
      Returns the FilterOperator
      Specified by:
      getOperator in interface com.appiancorp.common.query.ReadOnlyFilter
      Returns:
      the FilterOperator
    • getValueExpression

      public String getValueExpression()
      Return the value expression used as a constraint on the column or alias
      Specified by:
      getValueExpression in interface com.appiancorp.common.query.ReadOnlyFilter
      Returns:
      the object use to constraint the column or alias
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isPartOfCriteriaPredicate

      public static final com.appiancorp.common.query.Filter.IsPartOfCriteriaPredicate isPartOfCriteriaPredicate(Criteria c)
      Returns the predicate function which checks if given Filter is contained in a certain Criteria
      Parameters:
      c - a Criteria
      Returns:
      a predicate function which checks if given Filter is contained in a certain Criteria
    • containsFilters

      public static <T> boolean containsFilters(Criteria criteria, Iterable<Filter<T>> filters)
      Checks if all the filters are contained by the given criteria
      Parameters:
      criteria - a Criteria
      filters - iterable Filters
      Returns:
      true if all the filters are contained by the given criteria; false otherwise
    • selectField

      public static com.google.common.base.Function<Filter<?>,String> selectField()
      Returns a Function which retrieves the column/alias/field name from a given Filter
      Returns:
      a Function which retrieves the column/alias/field name from a given Filter