Class AbstractFilter<T>

  • Type Parameters:
    T - The type of object that gets filtered
    All Implemented Interfaces:
    Condition<T>, Filter<T>, java.io.Serializable
    Direct Known Subclasses:
    AlarmFilter

    public abstract class AbstractFilter<T>
    extends java.lang.Object
    implements Filter<T>
    The base implementation of a filter. A filter, simply put, is a group of conditions that operate against a type T. It can answer "does this T value match our conditions".
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractFilter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <F extends AbstractFilter<T>,​V,​C extends Condition<V>>
      F
      and​(Field<T,​V,​C> field, C condition)  
      <V,​C extends Condition<V>>
      C
      getConditionFor​(Field<T,​V,​C> field)
      Returns the condition for the field, or null if it doesn't exist.
      boolean hasConditionFor​(Field<T,​?,​?> field)
      Returns whether the filter has a condition for the field.
      protected void logCondition​(Condition<?> c, java.lang.Object value, boolean passed)
      Can be overridden to log success/failure conditions.
      boolean passes​(T value)
      Returns whether the provided value passes the condition.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractFilter

        public AbstractFilter()
    • Method Detail

      • passes

        public boolean passes​(T value)
        Description copied from interface: Condition
        Returns whether the provided value passes the condition.
        Specified by:
        passes in interface Condition<T>
      • hasConditionFor

        public boolean hasConditionFor​(Field<T,​?,​?> field)
        Description copied from interface: Filter
        Returns whether the filter has a condition for the field.
        Specified by:
        hasConditionFor in interface Filter<T>
      • getConditionFor

        public <V,​C extends Condition<V>> C getConditionFor​(Field<T,​V,​C> field)
        Description copied from interface: Filter
        Returns the condition for the field, or null if it doesn't exist.
        Specified by:
        getConditionFor in interface Filter<T>
      • logCondition

        protected void logCondition​(Condition<?> c,
                                    java.lang.Object value,
                                    boolean passed)
        Can be overridden to log success/failure conditions.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object