Class EvaluatorCollection

  • Direct Known Subclasses:
    And, Join, Or, Query

    public abstract class EvaluatorCollection
    extends java.lang.Object
    Collection of evaluator components.
    Author:
    javaito
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Set<Evaluator> evaluators  
    • Method Summary

      Modifier and Type Method Description
      EvaluatorCollection addBoolean​(java.lang.Object value)
      Add a particular evaluator that implements the true or false evaluation.
      EvaluatorCollection addEvaluator​(Evaluator evaluator)
      Add an instance of the evaluator object that evaluate if some instance of the data collection must be in the result add or not.
      EvaluatorCollection and()
      Add a group evaluator with 'and' function, by default return evaluate with false.
      protected Evaluator checkEvaluator​(Evaluator evaluator)  
      EvaluatorCollection distinct​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'distinct' method.
      EvaluatorCollection equals​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'equals' method.
      java.util.Set<Evaluator> getEvaluators()
      Return the unmodifiable set with evaluators.
      java.util.Collection<Evaluator> getFieldEvaluators​(java.lang.String fieldName, java.lang.Class<? extends FieldEvaluator>... evaluatorType)
      Return the collection of evaluators that corresponds to provided fieldName and types
      EvaluatorCollection greaterThan​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'greater than' method.
      EvaluatorCollection greaterThanOrEquals​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'greater than or equals' method.
      boolean hasEvaluators()
      Returns false if the collection is empty or all the elements are TrueEvaluator.
      EvaluatorCollection in​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'in' method.
      EvaluatorCollection like​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'like' method.
      EvaluatorCollection notIn​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'not in' method.
      protected boolean onAddEvaluator​(Evaluator evaluator)
      This method is called when some evaluator is added to the collection.
      EvaluatorCollection or()
      Add a group evaluator with 'or' function, by default return evaluate with false.
      EvaluatorCollection smallerThan​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'smaller than' method.
      EvaluatorCollection smallerThanOrEqual​(java.lang.Object leftValue, java.lang.Object rightValue)
      Add a particular evaluator that implements 'smaller than or equals' method.
      EvaluatorCollection up()
      Return the parent of the evaluator collection, the parent is other instance of evaluator collection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • evaluators

        protected final java.util.Set<Evaluator> evaluators
    • Constructor Detail

      • EvaluatorCollection

        public EvaluatorCollection()
    • Method Detail

      • getEvaluators

        public final java.util.Set<Evaluator> getEvaluators()
        Return the unmodifiable set with evaluators.
        Returns:
        Evaluators.
      • hasEvaluators

        public boolean hasEvaluators()
        Returns false if the collection is empty or all the elements are TrueEvaluator. It is used on reduced queries to check if there are still some evaluators to eval.
        Returns:
        true if the collection is not empty and there is at least one evaluator not instance of TrueEvaluator.
      • up

        public final EvaluatorCollection up()
        Return the parent of the evaluator collection, the parent is other instance of evaluator collection.
        Returns:
        Parent of the collection, could be null.
      • addEvaluator

        public final EvaluatorCollection addEvaluator​(Evaluator evaluator)
        Add an instance of the evaluator object that evaluate if some instance of the data collection must be in the result add or not.
        Parameters:
        evaluator - FieldEvaluator instance.
        Returns:
        Return the same instance of this class.
        Throws:
        java.lang.IllegalArgumentException - If the instance of the evaluator is null.
      • onAddEvaluator

        protected boolean onAddEvaluator​(Evaluator evaluator)
        This method is called when some evaluator is added to the collection.
        Parameters:
        evaluator - Evaluator added.
        Returns:
        True if the evaluator must be added into the evaluator collection.
      • getFieldEvaluators

        public java.util.Collection<Evaluator> getFieldEvaluators​(java.lang.String fieldName,
                                                                  java.lang.Class<? extends FieldEvaluator>... evaluatorType)
        Return the collection of evaluators that corresponds to provided fieldName and types
        Parameters:
        fieldName - Field name.
        evaluatorType - Evaluator types.
        Returns:
        collection of evaluators
      • addBoolean

        public final EvaluatorCollection addBoolean​(java.lang.Object value)
        Add a particular evaluator that implements the true or false evaluation.
        Parameters:
        value - Object to obtain the boolean value.
        Returns:
        Return the same instance of this class.
      • distinct

        public final EvaluatorCollection distinct​(java.lang.Object leftValue,
                                                  java.lang.Object rightValue)
        Add a particular evaluator that implements 'distinct' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • equals

        public final EvaluatorCollection equals​(java.lang.Object leftValue,
                                                java.lang.Object rightValue)
        Add a particular evaluator that implements 'equals' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • greaterThan

        public final EvaluatorCollection greaterThan​(java.lang.Object leftValue,
                                                     java.lang.Object rightValue)
        Add a particular evaluator that implements 'greater than' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • greaterThanOrEquals

        public final EvaluatorCollection greaterThanOrEquals​(java.lang.Object leftValue,
                                                             java.lang.Object rightValue)
        Add a particular evaluator that implements 'greater than or equals' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • in

        public final EvaluatorCollection in​(java.lang.Object leftValue,
                                            java.lang.Object rightValue)
        Add a particular evaluator that implements 'in' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • notIn

        public final EvaluatorCollection notIn​(java.lang.Object leftValue,
                                               java.lang.Object rightValue)
        Add a particular evaluator that implements 'not in' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • smallerThan

        public final EvaluatorCollection smallerThan​(java.lang.Object leftValue,
                                                     java.lang.Object rightValue)
        Add a particular evaluator that implements 'smaller than' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • smallerThanOrEqual

        public final EvaluatorCollection smallerThanOrEqual​(java.lang.Object leftValue,
                                                            java.lang.Object rightValue)
        Add a particular evaluator that implements 'smaller than or equals' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • like

        public final EvaluatorCollection like​(java.lang.Object leftValue,
                                              java.lang.Object rightValue)
        Add a particular evaluator that implements 'like' method.
        Parameters:
        leftValue - Left value of the operation.
        rightValue - Right value of the operation.
        Returns:
        Return the same instance of this class.
      • or

        public final EvaluatorCollection or()
        Add a group evaluator with 'or' function, by default return evaluate with false.
        Returns:
        Return the instance of the new evaluator collection (or instance);
      • and

        public final EvaluatorCollection and()
        Add a group evaluator with 'and' function, by default return evaluate with false.
        Returns:
        Return the instance of the new evaluator collection (and instance);