Class Filters


  • public class Filters
    extends Object
    Utility class that wraps an instance of a filter and provides methods for working with filters.
    • Constructor Detail

      • Filters

        public Filters​(Filter filter)
    • Method Detail

      • isBoolean

        public boolean isBoolean()
        Determine whether the filter is a bool filter
        Returns:
        true if the filter is a BooleanFilter, otherwise false
      • hasAnyFilter

        public boolean hasAnyFilter()
        Determine whether the filter contains a nested any filter
        Returns:
        true if the filter is a BooleanFilter and it contains an any filter
      • hasAllFilter

        public boolean hasAllFilter()
        Determine whether the filter contains a nested all filter
        Returns:
        true if the filter is a BooleanFilter and it contains an all filter
      • hasNoneFilter

        public boolean hasNoneFilter()
        Determine whether the filter contains a nested none filter
        Returns:
        true if the filter is a BooleanFilter and it contains a none filter
      • isField

        public boolean isField()
        Determine whether the filter applies to a field. Boolean filters do not directly apply to fields and would return false
        Returns:
        true if the filter applies to a field, otherwise false.
      • getFieldFilter

        public <T extends FieldFilter> Optional<T> getFieldFilter​(Class<T> clazz)
        Ensure that the filter is a field filter, and cast it to the appropriate class type
        Type Parameters:
        T - The given concrete FieldFilter class
        Parameters:
        clazz - The concrete FieldFilter class that the filter represents
        Returns:
        an Optional that will contain the given FieldFilter class type, or an empty Optional if the filter is null or is not the given class type
      • getBooleanFilter

        public Optional<BooleanFilter> getBooleanFilter()
        Ensure that the filter is a bool filter, and cast it to a BooleanFilter
        Returns:
        an Optional that will contain the given BooleanFilter, or an empty Optional if the filter is null or is not a BooleanFilter