org.inria.ns.reflex.xml.xpath
Class MixedExpression

java.lang.Object
  extended by org.inria.ns.reflex.xml.xpath.Expression
      extended by org.inria.ns.reflex.xml.xpath.MixedExpression

public class MixedExpression
extends Expression

A MixedExpression is used when an expression contains a mixed-string of alternatively simple strings and XPath expression surrounded by curly braces.

The static method parseValueTemplate will compile such an expression string in a MixedExpression object.

At runtime, the compute method will return a string that is a concatenation of the differents computed parts of the expression.

Author:
Philippe Poulard

Constructor Summary
MixedExpression(String expression, List parts, XFactory factory)
          Creates a new instance of MixedExpression
 
Method Summary
 Object compute(XPathContext context)
          Provides a runtime computation of the compiled expression with the dataset.
 Expression[] getExpressions()
          Return the ordered collection of StringExpression s and XPathExpression s that are parts of the expression.
 
Methods inherited from class org.inria.ns.reflex.xml.xpath.Expression
compute, compute, equals, getExpression, hashCode, parseValueTemplate, parseValueTemplate, parseValueTemplate, parseValueTemplate, parseValueTemplate, parseValueTemplate, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MixedExpression

public MixedExpression(String expression,
                       List parts,
                       XFactory factory)
Creates a new instance of MixedExpression

Parameters:
expression - The string used to compile the Expression.
parts - The ordered collection of Expression s and XPathExpression s that are parts of the expression.
Method Detail

compute

public Object compute(XPathContext context)
               throws XPathException
Provides a runtime computation of the compiled expression with the dataset.

Specified by:
compute in class Expression
Parameters:
variableResolver - The resolver used to retrieve the variables used for the computation.
Returns:
The result of the evaluated expression, as a String that is a concatenation of the differents computed parts of the expression.
Throws:
TransformerException - When the expression rises an XPath error at runtime.
XPathException - When the expression rises an XPath error at runtime.

getExpressions

public Expression[] getExpressions()
Return the ordered collection of StringExpression s and XPathExpression s that are parts of the expression.

Returns:
An array of Expression.