Class PropertyStringFilter

java.lang.Object
com.vaadin.hilla.crud.filter.Filter
com.vaadin.hilla.crud.filter.PropertyStringFilter

public class PropertyStringFilter extends Filter
A filter that matches a given property, or nested property path, against a filter value using the specified matcher.

Custom filter implementations need to handle this filter by:

  • Extracting the property value from the object being filtered using getPropertyId().
  • Convert the string representation of the filter value from getFilterValue() into a type that can be used for implementing a comparison.
  • Do the actual comparison using the matcher / operator provided by getMatcher()
  • Constructor Details

    • PropertyStringFilter

      public PropertyStringFilter()
  • Method Details

    • getPropertyId

      public String getPropertyId()
      Gets the property, or nested property path, to filter by. For example "name" or "address.city".
      Returns:
      the property name
    • setPropertyId

      public void setPropertyId(String propertyId)
      Sets the property, or nested property path, to filter by.
      Parameters:
      propertyId - the property name
    • getFilterValue

      public String getFilterValue()
      Gets the filter value to compare against. The filter value is always stored as a string, but can represent multiple types of values using specific formats. For example, when filtering a property of type LocalDate, the filter value could be "2020-01-01". The actual filter implementation is responsible for parsing the filter value into the correct type to use for querying the underlying data layer.
      Returns:
      the filter value
    • setFilterValue

      public void setFilterValue(String filterValue)
      Sets the filter value to compare against.
      Parameters:
      filterValue - the filter value
    • getMatcher

      public PropertyStringFilter.Matcher getMatcher()
      The matcher, or operator, to use when comparing the property value to the filter value.
      Returns:
      the matcher
    • setMatcher

      public void setMatcher(PropertyStringFilter.Matcher type)
      Sets the matcher, or operator, to use when comparing the property value to the filter value.
      Parameters:
      type - the matcher
    • toString

      public String toString()
      Overrides:
      toString in class Object