Class FieldEvaluator

  • All Implemented Interfaces:
    Evaluator
    Direct Known Subclasses:
    Equals, GreaterThan, In, Like, SmallerThan

    public abstract class FieldEvaluator
    extends BaseEvaluator
    This abstract class define the structure of the evaluating. The evaluator is the implementation of a method to decide if an object is part of the result of the query or not is.
    Author:
    javaito
    • Constructor Detail

      • FieldEvaluator

        public FieldEvaluator​(java.lang.Object leftValue,
                              java.lang.Object rightValue)
    • Method Detail

      • containsReference

        public final boolean containsReference​(java.lang.String fieldName)
        This method check if the evaluator contains a reference of the field indicated as parameter.
        Parameters:
        fieldName - Field name.
        Returns:
        True if the evaluator contains the reference and false in the otherwise.
      • getLeftValue

        public final java.lang.Object getLeftValue()
        Returns the left value of the evaluator.
        Returns:
        Left value of the evaluator.
      • getProcessedLeftValue

        protected final java.lang.Object getProcessedLeftValue​(java.lang.Object currentResultSetElement,
                                                               Queryable.DataSource dataSource,
                                                               Queryable.Consumer consumer)
        Returns the left processed value for the specific data source and consumer.
        Parameters:
        currentResultSetElement - Is the result set element to evaluate.
        dataSource - Data source instance.
        consumer - Consumer instance.
        Returns:
        Processed left value.
      • getRightValue

        public final java.lang.Object getRightValue()
        Returns the right value of the evaluator.
        Returns:
        Right value of the evaluator.
      • getProcessedRightValue

        protected final java.lang.Object getProcessedRightValue​(java.lang.Object currentResultSetElement,
                                                                Queryable.DataSource dataSource,
                                                                Queryable.Consumer consumer)
        Returns the right processed value for the specific data source and consumer.
        Parameters:
        currentResultSetElement - Is the result set element to evaluate.
        dataSource - Data source instance.
        consumer - Consumer instance.
        Returns:
        Processed right value.
      • copy

        public final FieldEvaluator copy()
        Copy this field evaluator with other value.
        Returns:
        New instance.
      • numberEquals

        protected boolean numberEquals​(java.lang.Number fieldValue,
                                       java.lang.Object value)
        Normalize any kind of number and compare both;
        Parameters:
        fieldValue - Field value.
        value - Value.
        Returns:
        True if the field value and value are equals as number.
      • equals

        public boolean equals​(java.lang.Object obj)
        Two evaluators are equals when are instances of the same class, his field names are equals and his values are equals
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - Object to compare.
        Returns:
        True if the instance is equals than object parameter and false in the other ways.
      • toString

        public java.lang.String toString()
        Return the string representation of the evaluator.
        Overrides:
        toString in class java.lang.Object
        Returns:
        Format: ClassName[fieldName,value]