2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.api.schema.tree.spi;
10 import com.google.common.base.MoreObjects.ToStringHelper;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
17 * Concretization of AbstractTreeNode for leaf nodes which only contain data.
18 * Instances of this class report all children as absent, subtree version
19 * equal to this node's version and do not support mutable view.
21 final class ValueNode extends AbstractTreeNode {
22 private static final Logger LOG = LoggerFactory.getLogger(ValueNode.class);
24 protected ValueNode(final NormalizedNode<?, ?> data, final Version version) {
29 public TreeNode childByArg(final PathArgument arg) {
30 LOG.warn("Attempted to access child {} of value-node {}", arg, this);
35 public Version getSubtreeVersion() {
40 public MutableTreeNode mutable() {
42 * Value nodes can only we read/written/delete, which does a straight
43 * replace. That means they don't haver need to be made mutable.
45 throw new UnsupportedOperationException(String.format("Attempted to mutate value-node %s", this));
49 protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
50 return helper.add("value", getData());