Class OperandEvaluator


  • public class OperandEvaluator
    extends java.lang.Object
    Evaluator of QOM operands. This class evaluates operands in the context of a value factory, a set of bind variables and possibly a query result row.
    • Constructor Summary

      Constructors 
      Constructor Description
      OperandEvaluator​(javax.jcr.ValueFactory factory, java.util.Map<java.lang.String,​javax.jcr.Value> variables)
      Creates an operand evaluator for the given value factory and set of bind variables.
      OperandEvaluator​(javax.jcr.ValueFactory factory, java.util.Map<java.lang.String,​javax.jcr.Value> variables, java.util.Locale locale)
      Creates an operand evaluator for the given value factory and set of bind variables.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.jcr.Value getValue​(javax.jcr.query.qom.Operand operand, javax.jcr.query.Row row)
      Returns the value of the given operand in the context of the given row.
      javax.jcr.Value getValue​(javax.jcr.query.qom.StaticOperand operand)
      Returns the value of the given static operand (literal or bind variable).
      javax.jcr.Value getValue​(javax.jcr.query.qom.StaticOperand operand, int type)
      Returns the value of the given static operand (literal or bind variable) casted to the given type.
      javax.jcr.Value[] getValues​(javax.jcr.query.qom.Operand operand, javax.jcr.Node node)
      Evaluates the given operand in the context of the given node.
      javax.jcr.Value[] getValues​(javax.jcr.query.qom.Operand operand, javax.jcr.query.Row row)
      Evaluates the given operand in the context of the given row.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OperandEvaluator

        public OperandEvaluator​(javax.jcr.ValueFactory factory,
                                java.util.Map<java.lang.String,​javax.jcr.Value> variables,
                                java.util.Locale locale)
        Creates an operand evaluator for the given value factory and set of bind variables. Upper- and lower-case conversions are performed using the given locale.
        Parameters:
        factory - value factory
        variables - bind variables
        locale - locale to use in upper- and lower-case conversions
      • OperandEvaluator

        public OperandEvaluator​(javax.jcr.ValueFactory factory,
                                java.util.Map<java.lang.String,​javax.jcr.Value> variables)
        Creates an operand evaluator for the given value factory and set of bind variables. Upper- and lower-case conversions are performed using the Locale.ENGLISH.
        Parameters:
        factory - value factory
        variables - bind variables
    • Method Detail

      • getValue

        public javax.jcr.Value getValue​(javax.jcr.query.qom.StaticOperand operand,
                                        int type)
                                 throws javax.jcr.RepositoryException
        Returns the value of the given static operand (literal or bind variable) casted to the given type.
        Parameters:
        operand - static operand to be evaluated
        type - expected value type
        Returns:
        evaluated value, casted to the given type
        Throws:
        javax.jcr.RepositoryException - if a named bind variable is not found, if the operand type is unknown, or if the type conversion fails
      • getValue

        public javax.jcr.Value getValue​(javax.jcr.query.qom.StaticOperand operand)
                                 throws javax.jcr.RepositoryException
        Returns the value of the given static operand (literal or bind variable).
        Parameters:
        operand - static operand to be evaluated
        Returns:
        evaluated value
        Throws:
        javax.jcr.RepositoryException - if a named bind variable is not found, or if the operand type is unknown
      • getValue

        public javax.jcr.Value getValue​(javax.jcr.query.qom.Operand operand,
                                        javax.jcr.query.Row row)
                                 throws javax.jcr.RepositoryException
        Returns the value of the given operand in the context of the given row. This is a convenience method that uses a somewhat lossy best-effort mapping to evaluate multi-valued operands to a single value. Use the getValues(Operand, Row) method for more accurate results.
        Parameters:
        operand - operand to be evaluated
        row - query result row
        Returns:
        evaluated value
        Throws:
        javax.jcr.RepositoryException - if the operand can't be evaluated
      • getValues

        public javax.jcr.Value[] getValues​(javax.jcr.query.qom.Operand operand,
                                           javax.jcr.query.Row row)
                                    throws javax.jcr.RepositoryException
        Evaluates the given operand in the context of the given row.
        Parameters:
        operand - operand to be evaluated
        row - query result row
        Returns:
        values of the operand at the given row
        Throws:
        javax.jcr.RepositoryException - if the operand can't be evaluated
      • getValues

        public javax.jcr.Value[] getValues​(javax.jcr.query.qom.Operand operand,
                                           javax.jcr.Node node)
                                    throws javax.jcr.RepositoryException
        Evaluates the given operand in the context of the given node.
        Parameters:
        operand - operand to be evaluated
        node - node
        Returns:
        values of the operand at the given node
        Throws:
        javax.jcr.RepositoryException - if the operand can't be evaluated