Class OperandEvaluator
- java.lang.Object
-
- org.apache.jackrabbit.commons.query.qom.OperandEvaluator
-
public class OperandEvaluator extends java.lang.Object
Evaluator of QOMoperands
. This class evaluates operands in the context of avalue factory
, a set of bind variables and possibly a query result row.
-
-
Constructor Summary
Constructors Constructor Description OperandEvaluator(ValueFactory factory, java.util.Map<java.lang.String,Value> variables)
Creates an operand evaluator for the given value factory and set of bind variables.OperandEvaluator(ValueFactory factory, java.util.Map<java.lang.String,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 Value
getValue(Operand operand, Row row)
Returns the value of the given operand in the context of the given row.Value
getValue(StaticOperand operand)
Returns the value of the given static operand (literal
orbind variable
).Value
getValue(StaticOperand operand, int type)
Returns the value of the given static operand (literal
orbind variable
) casted to the given type.Value[]
getValues(Operand operand, Node node)
Evaluates the given operand in the context of the given node.Value[]
getValues(Operand operand, Row row)
Evaluates the given operand in the context of the given row.
-
-
-
Constructor Detail
-
OperandEvaluator
public OperandEvaluator(ValueFactory factory, java.util.Map<java.lang.String,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 factoryvariables
- bind variableslocale
- locale to use in upper- and lower-case conversions
-
OperandEvaluator
public OperandEvaluator(ValueFactory factory, java.util.Map<java.lang.String,Value> variables)
Creates an operand evaluator for the given value factory and set of bind variables. Upper- and lower-case conversions are performed using theLocale.ENGLISH
.- Parameters:
factory
- value factoryvariables
- bind variables
-
-
Method Detail
-
getValue
public Value getValue(StaticOperand operand, int type) throws RepositoryException
Returns the value of the given static operand (literal
orbind variable
) casted to the given type.- Parameters:
operand
- static operand to be evaluatedtype
- expected value type- Returns:
- evaluated value, casted to the given type
- Throws:
RepositoryException
- if a named bind variable is not found, if the operand type is unknown, or if the type conversion fails
-
getValue
public Value getValue(StaticOperand operand) throws RepositoryException
Returns the value of the given static operand (literal
orbind variable
).- Parameters:
operand
- static operand to be evaluated- Returns:
- evaluated value
- Throws:
RepositoryException
- if a named bind variable is not found, or if the operand type is unknown
-
getValue
public Value getValue(Operand operand, Row row) throws 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 thegetValues(Operand, Row)
method for more accurate results.- Parameters:
operand
- operand to be evaluatedrow
- query result row- Returns:
- evaluated value
- Throws:
RepositoryException
- if the operand can't be evaluated
-
getValues
public Value[] getValues(Operand operand, Row row) throws RepositoryException
Evaluates the given operand in the context of the given row.- Parameters:
operand
- operand to be evaluatedrow
- query result row- Returns:
- values of the operand at the given row
- Throws:
RepositoryException
- if the operand can't be evaluated
-
getValues
public Value[] getValues(Operand operand, Node node) throws RepositoryException
Evaluates the given operand in the context of the given node.- Parameters:
operand
- operand to be evaluatednode
- node- Returns:
- values of the operand at the given node
- Throws:
RepositoryException
- if the operand can't be evaluated
-
-