Class XPathVariableProvider
- java.lang.Object
-
- de.aristaflow.adept2.model.common.xml.XPathVariableProvider
-
- Direct Known Subclasses:
XPathSystemDataProvider
public abstract class XPathVariableProvider extends Object
This class handles variables that can be used in XPath expressions. The variables need to be declared in theXPathCompiler
and the corresponding values need to be set in theXPathSelector
. 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$
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
XPathVariableProvider()
Creates a new variable provider.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description net.sf.saxon.s9api.XPathCompiler
declareVariables(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>>
getVariables()
Gets all variables provided by this class.protected abstract net.sf.saxon.s9api.XdmValue
getVariableValue(net.sf.saxon.s9api.QName variable)
Gets the value of the designated variable.net.sf.saxon.s9api.XPathSelector
setVariables(net.sf.saxon.s9api.XPathSelector selector)
Sets all values of all variables of this provider in the designatedXPathSelector
.
-
-
-
Field Detail
-
variables
protected Map<net.sf.saxon.s9api.QName,Pair<net.sf.saxon.s9api.ItemType,net.sf.saxon.s9api.OccurrenceIndicator>> variables
All variables to be replaced by this provider. The values within this map are optional. The map will be initialised when declaring variables.
-
-
Method Detail
-
declareVariables
public net.sf.saxon.s9api.XPathCompiler declareVariables(net.sf.saxon.s9api.XPathCompiler compiler)
Declares all variables in the designatedXPathCompiler
.- Parameters:
compiler
- TheXPathCompiler
in 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 correspondingXPathCompiler
previously.- Parameters:
selector
- TheXPathSelector
in 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, aSaxonApiException
will be thrown.
-
getVariables
protected abstract Map<net.sf.saxon.s9api.QName,Pair<net.sf.saxon.s9api.ItemType,net.sf.saxon.s9api.OccurrenceIndicator>> getVariables()
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.
-
-