return false;
}
- final Object nodeValue = currentNodeContext.getNode().getValue();
+ final Object nodeValue = currentNodeContext.getNode().body();
if (!(nodeValue instanceof Set)) {
return false;
}
}
// deref(node-set nodes) function as per https://tools.ietf.org/html/rfc7950#section-10.3.1
- private static NormalizedNode<?, ?> deref(final Context context, final List<?> args) throws FunctionCallException {
+ private static NormalizedNode deref(final Context context, final List<?> args) throws FunctionCallException {
if (!args.isEmpty()) {
throw new FunctionCallException("deref() takes only one argument: node-set nodes.");
}
final NormalizedNodeContext currentNodeContext = verifyContext(context);
final TypedDataSchemaNode correspondingSchemaNode = getCorrespondingTypedSchemaNode(currentNodeContext);
- final Object nodeValue = currentNodeContext.getNode().getValue();
+ final Object nodeValue = currentNodeContext.getNode().body();
final TypeDefinition<?> type = correspondingSchemaNode.getType();
if (type instanceof InstanceIdentifierTypeDefinition) {
return nodeValue instanceof YangInstanceIdentifier
final SchemaContext schemaContext = getSchemaContext(currentNodeContext);
return correspondingSchemaNode.getType() instanceof IdentityrefTypeDefinition
- && currentNodeContext.getNode().getValue() instanceof QName ? new SimpleImmutableEntry<>(
+ && currentNodeContext.getNode().body() instanceof QName ? new SimpleImmutableEntry<>(
getIdentitySchemaNodeFromString((String) args.get(0), schemaContext, correspondingSchemaNode),
- getIdentitySchemaNodeFromQName((QName) currentNodeContext.getNode().getValue(), schemaContext))
+ getIdentitySchemaNodeFromQName((QName) currentNodeContext.getNode().body(), schemaContext))
: null;
}
return DOUBLE_NAN;
}
- final Object nodeValue = currentNodeContext.getNode().getValue();
+ final Object nodeValue = currentNodeContext.getNode().body();
if (!(nodeValue instanceof String)) {
return DOUBLE_NAN;
}
+ " identity schema node in the module %s.", identityQName, module));
}
- private static NormalizedNode<?, ?> getNodeReferencedByInstanceIdentifier(final YangInstanceIdentifier path,
+ private static NormalizedNode getNodeReferencedByInstanceIdentifier(final YangInstanceIdentifier path,
final NormalizedNodeContext currentNodeContext) {
final NormalizedNodeNavigator navigator = (NormalizedNodeNavigator) currentNodeContext.getNavigator();
- final NormalizedNode<?, ?> rootNode = navigator.getDocument().getRootNode();
+ final NormalizedNode rootNode = navigator.getDocument().getRootNode();
final List<PathArgument> pathArguments = path.getPathArguments();
if (pathArguments.get(0).getNodeType().equals(rootNode.getNodeType())) {
final List<PathArgument> relPath = pathArguments.subList(1, pathArguments.size());
- final Optional<NormalizedNode<?, ?>> possibleNode = NormalizedNodes.findNode(rootNode, relPath);
+ final Optional<NormalizedNode> possibleNode = NormalizedNodes.findNode(rootNode, relPath);
if (possibleNode.isPresent()) {
return possibleNode.get();
}
return null;
}
- private static NormalizedNode<?, ?> getNodeReferencedByLeafref(final PathExpression xpath,
+ private static NormalizedNode getNodeReferencedByLeafref(final PathExpression xpath,
final NormalizedNodeContext currentNodeContext, final SchemaContext schemaContext,
final TypedDataSchemaNode correspondingSchemaNode, final Object nodeValue) {
- final NormalizedNode<?, ?> referencedNode = xpath.isAbsolute() ? getNodeReferencedByAbsoluteLeafref(xpath,
+ final NormalizedNode referencedNode = xpath.isAbsolute() ? getNodeReferencedByAbsoluteLeafref(xpath,
currentNodeContext, schemaContext, correspondingSchemaNode) : getNodeReferencedByRelativeLeafref(xpath,
currentNodeContext, schemaContext, correspondingSchemaNode);
return getReferencedLeafSetEntryNode((LeafSetNode<?>) referencedNode, nodeValue);
}
- if (referencedNode instanceof LeafNode && referencedNode.getValue().equals(nodeValue)) {
+ if (referencedNode instanceof LeafNode && referencedNode.body().equals(nodeValue)) {
return referencedNode;
}
return null;
}
- private static NormalizedNode<?, ?> getNodeReferencedByAbsoluteLeafref(final PathExpression xpath,
+ private static NormalizedNode getNodeReferencedByAbsoluteLeafref(final PathExpression xpath,
final NormalizedNodeContext currentNodeContext, final SchemaContext schemaContext,
final TypedDataSchemaNode correspondingSchemaNode) {
final LeafrefXPathStringParsingPathArgumentBuilder builder = new LeafrefXPathStringParsingPathArgumentBuilder(
xpath.getOriginalString(), schemaContext, correspondingSchemaNode, currentNodeContext);
final List<PathArgument> pathArguments = builder.build();
final NormalizedNodeNavigator navigator = (NormalizedNodeNavigator) currentNodeContext.getNavigator();
- final NormalizedNode<?, ?> rootNode = navigator.getDocument().getRootNode();
+ final NormalizedNode rootNode = navigator.getDocument().getRootNode();
if (pathArguments.get(0).getNodeType().equals(rootNode.getNodeType())) {
final List<PathArgument> relPath = pathArguments.subList(1, pathArguments.size());
- final Optional<NormalizedNode<?, ?>> possibleNode = NormalizedNodes.findNode(rootNode, relPath);
+ final Optional<NormalizedNode> possibleNode = NormalizedNodes.findNode(rootNode, relPath);
if (possibleNode.isPresent()) {
return possibleNode.get();
}
return null;
}
- private static NormalizedNode<?, ?> getNodeReferencedByRelativeLeafref(final PathExpression xpath,
+ private static NormalizedNode getNodeReferencedByRelativeLeafref(final PathExpression xpath,
final NormalizedNodeContext currentNodeContext, final SchemaContext schemaContext,
final TypedDataSchemaNode correspondingSchemaNode) {
NormalizedNodeContext relativeNodeContext = currentNodeContext;
final LeafrefXPathStringParsingPathArgumentBuilder builder = new LeafrefXPathStringParsingPathArgumentBuilder(
xPathStringBuilder.toString(), schemaContext, correspondingSchemaNode, currentNodeContext);
final List<PathArgument> pathArguments = builder.build();
- final NormalizedNode<?, ?> relativeNode = relativeNodeContext.getNode();
- final Optional<NormalizedNode<?, ?>> possibleNode = NormalizedNodes.findNode(relativeNode, pathArguments);
- if (possibleNode.isPresent()) {
- return possibleNode.get();
- }
-
- return null;
+ final NormalizedNode relativeNode = relativeNodeContext.getNode();
+ return NormalizedNodes.findNode(relativeNode, pathArguments).orElse(null);
}
private static LeafSetEntryNode<?> getReferencedLeafSetEntryNode(final LeafSetNode<?> referencedNode,
final Object currentNodeValue) {
- for (final LeafSetEntryNode<?> entryNode : referencedNode.getValue()) {
- if (currentNodeValue.equals(entryNode.getValue())) {
+ for (final LeafSetEntryNode<?> entryNode : referencedNode.body()) {
+ if (currentNodeValue.equals(entryNode.body())) {
return entryNode;
}
}