Class QueryExpression

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ADD
      Addition of two numeric fields
      static int DIVIDE
      Division of two numeric fields
      static int GREATEST
      Return the greatest value from two expressions, e.g.
      static int INDEX_OF
      Position of specified string in other specified string
      static int LEAST
      Return the lowest value from two expressions, e.g.
      static int LOWER
      Lower case version of the given string
      static int MODULO
      Return the modulo of two expressions, e.g.
      static int MULTIPLY
      Multiplication of two numeric fields
      static int SUBSTRING
      Substring of specified length from index in string
      static int SUBTRACT
      Subtraction of two numeric fields
      static int UPPER
      Upper case version of the given string
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getApproximateType()
      Returns an integer representing the approximate type of this QueryEvaluable, in the case where an accurate type cannot be ascertained.
      QueryEvaluable getArg1()
      Returns the left argument of the expression.
      QueryEvaluable getArg2()
      Returns the right argument, or the position argument of the substring.
      QueryEvaluable getArg3()
      Returns the length argument of a substring expression.
      int getOperation()
      Returns the operation.
      java.lang.Class<?> getType()
      Get Java type represented by this item.
      void youAreType​(java.lang.Class<?> cls)
      Allows a caller to suggest to this object that it holds a value of a certain type.
      • Methods inherited from class java.lang.Object

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

      • SUBTRACT

        public static final int SUBTRACT
        Subtraction of two numeric fields
        See Also:
        Constant Field Values
      • MULTIPLY

        public static final int MULTIPLY
        Multiplication of two numeric fields
        See Also:
        Constant Field Values
      • SUBSTRING

        public static final int SUBSTRING
        Substring of specified length from index in string
        See Also:
        Constant Field Values
      • INDEX_OF

        public static final int INDEX_OF
        Position of specified string in other specified string
        See Also:
        Constant Field Values
      • LOWER

        public static final int LOWER
        Lower case version of the given string
        See Also:
        Constant Field Values
      • UPPER

        public static final int UPPER
        Upper case version of the given string
        See Also:
        Constant Field Values
      • GREATEST

        public static final int GREATEST
        Return the greatest value from two expressions, e.g. (col1, 0)
        See Also:
        Constant Field Values
      • LEAST

        public static final int LEAST
        Return the lowest value from two expressions, e.g. (col1, 0)
        See Also:
        Constant Field Values
      • MODULO

        public static final int MODULO
        Return the modulo of two expressions, e.g. (col1, 2)
        See Also:
        Constant Field Values
    • Constructor Detail

      • QueryExpression

        public QueryExpression​(QueryEvaluable arg1,
                               int op,
                               QueryEvaluable arg2)
        Constructs an arithmetic QueryExpression from two evaluable items
        Parameters:
        arg1 - the first argument
        op - the required operation
        arg2 - the second argument
        Throws:
        java.lang.IllegalArgumentException - if there is a mismatch between any of the argument types and the specified operation
      • QueryExpression

        public QueryExpression​(QueryEvaluable arg,
                               QueryEvaluable pos,
                               QueryEvaluable len)
        Constructs a substring QueryExpression from a QueryEvaluable and start and length QueryEvaluables
        Parameters:
        arg - A QueryEvaluable representing a String
        pos - start index
        len - length in characters
        Throws:
        java.lang.IllegalArgumentException - if there is a mismatch between the argument type and the specified operation
      • QueryExpression

        public QueryExpression​(int op,
                               QueryEvaluable arg)
        Constructs a String QueryExpression to perform upper and lowercase conversions.
        Parameters:
        op - the required operation
        arg - the String argument
        Throws:
        java.lang.IllegalArgumentException - if there is a mismatch between the argument and operation
    • Method Detail

      • getType

        public java.lang.Class<?> getType()
        Get Java type represented by this item.
        Specified by:
        getType in interface QueryOrderable
        Specified by:
        getType in interface QuerySelectable
        Returns:
        class describing the type
      • getOperation

        public int getOperation()
        Returns the operation.
        Returns:
        the operation of the expression
      • getArg1

        public QueryEvaluable getArg1()
        Returns the left argument of the expression.
        Returns:
        the left argument
      • getArg2

        public QueryEvaluable getArg2()
        Returns the right argument, or the position argument of the substring.
        Returns:
        argument 2
      • getArg3

        public QueryEvaluable getArg3()
        Returns the length argument of a substring expression.
        Returns:
        argument 3
      • youAreType

        public void youAreType​(java.lang.Class<?> cls)
        Allows a caller to suggest to this object that it holds a value of a certain type. This method should only be called on objects which report their type to be UnknownTypeValue. Otherwise, this method will throw and exception.
        Specified by:
        youAreType in interface QueryEvaluable
        Parameters:
        cls - the Class of the type to be imposed on this object
      • getApproximateType

        public int getApproximateType()
        Returns an integer representing the approximate type of this QueryEvaluable, in the case where an accurate type cannot be ascertained.
        Specified by:
        getApproximateType in interface QueryEvaluable
        Returns:
        an int, as described in UnknownTypeValue