Class XPathVariableProvider
java.lang.Object
de.aristaflow.adept2.model.common.xml.XPathVariableProvider
- Direct Known Subclasses:
XPathSystemDataProvider
This class handles variables that can be used in XPath expressions. The variables need to be
declared in the
The corresponding variables in XPath have to start with
XPathCompiler and the corresponding values need to be set in the
XPathSelector. Subclasses provide their supported variables (and optionally their
type and their occurrence indicator) in the constructor. The value will be requested as needed.
The corresponding variables in XPath have to start with
$.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnet.sf.saxon.s9api.XPathCompilerdeclareVariables(net.sf.saxon.s9api.XPathCompiler compiler) Declares all variables in the designatedXPathCompiler.protected abstract Map<net.sf.saxon.s9api.QName,Pair<net.sf.saxon.s9api.ItemType, net.sf.saxon.s9api.OccurrenceIndicator>> Gets all variables provided by this class.protected abstract net.sf.saxon.s9api.XdmValuegetVariableValue(net.sf.saxon.s9api.QName variable) Gets the value of the designated variable.net.sf.saxon.s9api.XPathSelectorsetVariables(net.sf.saxon.s9api.XPathSelector selector) Sets all values of all variables of this provider in the designatedXPathSelector.
-
Field Details
-
variables
protected Map<net.sf.saxon.s9api.QName,Pair<net.sf.saxon.s9api.ItemType, variablesnet.sf.saxon.s9api.OccurrenceIndicator>> All variables to be replaced by this provider. The values within this map are optional. The map will be initialised when declaring variables.
-
-
Constructor Details
-
XPathVariableProvider
protected XPathVariableProvider()Creates a new variable provider.
-
-
Method Details
-
declareVariables
public net.sf.saxon.s9api.XPathCompiler declareVariables(net.sf.saxon.s9api.XPathCompiler compiler) Declares all variables in the designatedXPathCompiler.- Parameters:
compiler- TheXPathCompilerin which to declare all variables of this provider.- Returns:
- The designated
XPathCompiler.
-
setVariables
public net.sf.saxon.s9api.XPathSelector setVariables(net.sf.saxon.s9api.XPathSelector selector) throws net.sf.saxon.s9api.SaxonApiException Sets all values of all variables of this provider in the designatedXPathSelector. The variables have to be declared in the correspondingXPathCompilerpreviously.- Parameters:
selector- TheXPathSelectorin which to set the values of all variables of this provider.- Returns:
- The designated
XPathSelector. - Throws:
net.sf.saxon.s9api.SaxonApiException- If the type of the value supplied does not conform to its declared type, aSaxonApiExceptionwill be thrown.
-
getVariables
protected abstract Map<net.sf.saxon.s9api.QName,Pair<net.sf.saxon.s9api.ItemType, getVariables()net.sf.saxon.s9api.OccurrenceIndicator>> Gets all variables provided by this class. The type and occurrence indicator are optional. If not provided, defaults will be used.- Returns:
- The variables to be replaced within an XPath. The variable name is required, the map values are optional. If a variable has no value in the map it will be declared with default type and occurrence indicator.
- See Also:
-
XPathCompiler.declareVariable(QName)
-
getVariableValue
protected abstract net.sf.saxon.s9api.XdmValue getVariableValue(net.sf.saxon.s9api.QName variable) Gets the value of the designated variable.- Parameters:
variable- The variable for which to get the value.- Returns:
- The value of the designated variable.
-