Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.exist.xquery
Class ExtensionExpression

    java.lang.Object
      org.exist.xquery.AbstractExpression
          org.exist.xquery.ExtensionExpression

All Implemented Interfaces:
  Expression

public class ExtensionExpression
extends AbstractExpression

Implements an XQuery extension expression. An extension expression starts with a list of pragmas, followed by an expression enclosed in curly braces. For evaluation details check {`eval(Sequence, Item)`.

Author:
  wolf

Field Summary

Fields inherited from interface org.exist.xquery.Expression
`DOT_TEST, EXPRESSION_ID_INVALID, IGNORE_CONTEXT, IN_PREDICATE, IN_UPDATE, IN_WHERE_CLAUSE, NO_CONTEXT_ID, SINGLE_STEP_EXECUTION`

Constructor Summary
`ExtensionExpression(XQueryContext context)`

Method Summary
`void` | `accept(ExpressionVisitor visitor)` Start traversing the expression tree using the specified `ExpressionVisitor`.
`void` | `addPragma(Pragma pragma)`
`void` | `analyze(AnalyzeContextInfo contextInfo)` Statically analyze the expression and its subexpressions.
`void` | `dump(ExpressionDumper dumper)` Write a diagnostic dump of the expression to the passed `ExpressionDumper`.
`Sequence` | `eval(Sequence contextSequence, Item contextItem)` For every pragma in the list, calls `Pragma.before(XQueryContext, Expression)` before evaluation.
`int` | `getCardinality()` The default cardinality is `Cardinality.EXACTLY_ONE`.
`int` | `getDependencies()` Returns `Dependency.DEFAULT_DEPENDENCIES`.
`void` | `resetState()` Called to inform an expression that it should reset to its initial state.
`int` | `returnsType()` The static return type of the expression.
`void` | `setContextDocSet(DocumentSet contextSet)`
`void` | `setExpression(Expression inner)`

Methods inherited from class org.exist.xquery.AbstractExpression
`eval, getASTNode, getContextDocSet, getContextId, getExpressionId, setASTNode, setPrimaryAxis`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ExtensionExpression

    public ExtensionExpression(XQueryContext context)

Method Detail

### setExpression

    public void setExpression(Expression inner)

### addPragma

    public void addPragma(Pragma pragma)

### eval

    public Sequence eval(Sequence contextSequence,
                         Item contextItem)
                  throws XPathException

  For every pragma in the list, calls `Pragma.before(XQueryContext, Expression)` before evaluation. The method then tries to call `Pragma.eval(Sequence, Item)` on every pragma. If a pragma does not return null for this call, the returned Sequence will become the result of the extension expression. If more than one pragma returns something for eval, an exception will be thrown. If all pragmas return null, we call eval on the original expression and return that.

  Specified by:
    `eval` in interface `Expression`
  Specified by:
    `eval` in class `AbstractExpression`
  Throws:
    `XPathException`

### returnsType

    public int returnsType()

  Description copied from interface: `Expression`
  The static return type of the expression. This method should return one of the type constants defined in class `Type`. If the return type cannot be determined statically, return Type.ITEM.

  Specified by:
    `returnsType` in interface `Expression`
  Specified by:
    `returnsType` in class `AbstractExpression`

### analyze

    public void analyze(AnalyzeContextInfo contextInfo)
                 throws XPathException

  Description copied from interface: `Expression`
  Statically analyze the expression and its subexpressions. During the static analysis phase, the query engine can detect unknown variables and some type errors.

  Throws:
    `XPathException`

### dump

    public void dump(ExpressionDumper dumper)

  Description copied from interface: `Expression`
  Write a diagnostic dump of the expression to the passed `ExpressionDumper`.

  Parameters:
    `dumper` - the expression dumper to write to

### getDependencies

    public int getDependencies()

  Description copied from class: `AbstractExpression`
  Returns `Dependency.DEFAULT_DEPENDENCIES`.

  Specified by:
    `getDependencies` in interface `Expression`
  Overrides:
    `getDependencies` in class `AbstractExpression`
  See Also:
    `Expression.getDependencies()`

### getCardinality

    public int getCardinality()

  Description copied from class: `AbstractExpression`
  The default cardinality is `Cardinality.EXACTLY_ONE`.

  Specified by:
    `getCardinality` in interface `Expression`
  Overrides:
    `getCardinality` in class `AbstractExpression`

### setContextDocSet

    public void setContextDocSet(DocumentSet contextSet)

  Specified by:
    `setContextDocSet` in interface `Expression`
  Overrides:
    `setContextDocSet` in class `AbstractExpression`

### resetState

    public void resetState()

  Description copied from interface: `Expression`
  Called to inform an expression that it should reset to its initial state. All cached data in the expression object should be dropped. For example, the document() function calls this method whenever the input document set has changed.

  Specified by:
    `resetState` in interface `Expression`
  Overrides:
    `resetState` in class `AbstractExpression`

### accept

    public void accept(ExpressionVisitor visitor)

  Description copied from interface: `Expression`
  Start traversing the expression tree using the specified `ExpressionVisitor`.

  Specified by:
    `accept` in interface `Expression`
  Overrides:
    `accept` in class `AbstractExpression`

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Wolfgang Meier. All rights reserved.