c90a60f89e7481b5982def616d8df81249c11225
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / tree / spi / MaterializedContainerNode.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.api.schema.tree.spi;
9
10 import com.google.common.base.Optional;
11 import java.util.Map;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14
15 /**
16  * A fully-modified node -- we know we have all children, so it performs lookups only.
17  */
18 final class MaterializedContainerNode extends AbstractModifiedContainerNode {
19     protected MaterializedContainerNode(final NormalizedNode<?, ?> data, final Version version,
20             final Map<PathArgument, TreeNode> children, final Version subtreeVersion) {
21         super(data, version, children, subtreeVersion);
22     }
23
24     @Override
25     public Optional<TreeNode> getChild(final PathArgument childId) {
26         return Optional.fromNullable(getModifiedChild(childId));
27     }
28
29     @Override
30     public MutableTreeNode mutable() {
31         return new MaterializedMutableContainerNode(this, snapshotChildren());
32     }
33 }