Interface YangXPathExpression
-
- All Superinterfaces:
Immutable
,MutationBehaviour<Immutable>
- All Known Subinterfaces:
YangXPathExpression.QualifiedBound
,YangXPathExpression.UnqualifiedBound
@Beta public interface YangXPathExpression extends Immutable
An XPath expression. This interface defines a parsed representation of an XPath defined in a YANG context, as specified in RFC7950, Section 6.4.The specification along with rules for
path
statement evaluation rules end up defining four incremental levels to which an XPath expression can be bound:- Unbound Expressions, which is a essentially a parse tree. No namespace binding has been performed, i.e. all
node identifiers are in
QualifiedQName
orUnqualifiedQName
form. This level is typically not used when dealing with YANG models directly, but can be useful for validating a String conforms to XPath syntax. - Qualified-bound Expressions, where all
QualifiedQName
s are resolved and bound toQName
s, butUnqualifiedQName
s are still present. This level corresponds to how far a YANG parser can interpret XPath expressions defined intypedef
statements and statements which are not fully instantiated, i.e. are descendants of agrouping
statement. - Namespace-bound Expressions, where all node identifier references are resolved to
QName
s. This level corresponds to how far a YANG parser can interpret XPath expressions at their place of instantiation, either in the data tree or anaction
/@{code rpc}/notification
or similar context. - Context-bound Expressions, where the expression is bound to a {code context node}, i.e.
current()
function result is know. This API does not handle this state, as it is inherently bound to a particular data object model.
- Author:
- Robert Varga
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
YangXPathExpression.QualifiedBound
A Qualified-bound expression.static interface
YangXPathExpression.UnqualifiedBound
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description YangXPathMathMode
getMathMode()
Return theYangXPathMathMode
used in this expression.YangExpr
getRootExpr()
Return the rootYangExpr
.default YangVersion
getYangVersion()
Return the minimum YangVersion runtime required to interpret this expression.YangLocationPath
interpretAsInstanceIdentifier(YangLiteralExpr expr)
YangQNameExpr
interpretAsQName(YangLiteralExpr expr)
Attempt to interpret aYangLiteralExpr
referenced by this expression as aQName
.
-
-
-
Method Detail
-
getMathMode
YangXPathMathMode getMathMode()
Return theYangXPathMathMode
used in this expression. AllYangNumberExpr
objects used by this expression are expected to be handled by this mode'sYangXPathMathSupport
.- Returns:
- YangXPathMathMode
-
getYangVersion
default YangVersion getYangVersion()
Return the minimum YangVersion runtime required to interpret this expression. The default implementation returnsYangVersion.VERSION_1_1
. Implementations are encouraged to provide a less conservative estimate.- Returns:
- YangVersion runtime version compatibility level required to accurately interpret this expression.
-
interpretAsQName
YangQNameExpr interpretAsQName(YangLiteralExpr expr) throws XPathExpressionException
Attempt to interpret aYangLiteralExpr
referenced by this expression as aQName
. This method is required to perform late value binding of the expression when the literal needs to be interpreted as a reference to anidentity
.The syntax of expr is required to conform to XML QName format, as further restricted by YANG
identityref
Lexical Representation.Unfortunately we do not know when a literal will need to be interpreted in this way, as that can only be known at evaluation.
- Parameters:
expr
- Literal to be reinterpreted- Returns:
- YangQNameExpr result of interpretation
- Throws:
XPathExpressionException
- when the literal cannot be interpreted as a QName
-
interpretAsInstanceIdentifier
YangLocationPath interpretAsInstanceIdentifier(YangLiteralExpr expr) throws XPathExpressionException
- Throws:
XPathExpressionException
-
-