*/
package org.opendaylight.yangtools.yang.data.api.schema.tree.spi;
-import java.util.Optional;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.DistinctNodeContainer;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
/**
* A TreeNode capable of holding child nodes. The fact that any of the children
* changed is tracked by the subtree version.
*/
abstract class AbstractContainerNode extends AbstractTreeNode {
- protected AbstractContainerNode(final NormalizedNode<?, ?> data, final Version version) {
+ protected AbstractContainerNode(final NormalizedNode data, final Version version) {
super(data, version);
}
@SuppressWarnings("unchecked")
- protected final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> castData() {
- return (NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>>) getData();
+ protected final DistinctNodeContainer<?, PathArgument, NormalizedNode> castData() {
+ return (DistinctNodeContainer<?, PathArgument, NormalizedNode>) getData();
}
protected final @Nullable TreeNode getChildFromData(final PathArgument childId) {
return getChildFromData(castData(), childId, getVersion());
}
- static TreeNode getChildFromData(final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> data,
+ static TreeNode getChildFromData(final DistinctNodeContainer<?, PathArgument, NormalizedNode> data,
final PathArgument childId, final Version version) {
- final Optional<NormalizedNode<?, ?>> child = data.getChild(childId);
- return child.isPresent() ? TreeNodeFactory.createTreeNode(child.get(), version) : null;
+ final NormalizedNode child = data.childByArg(childId);
+ return child != null ? TreeNodeFactory.createTreeNode(child, version) : null;
}
}