2b14f0e0a0570c84fd6dba938a04b99e68170dc4
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / WritableInteriorNode.java
1 /*
2  * Copyright (c) 2016 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
9 package org.opendaylight.mdsal.dom.store.inmemory;
10
11 import com.google.common.base.Preconditions;
12 import java.util.Map;
13 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15
16 class WritableInteriorNode extends WriteableNodeWithSubshard {
17
18     private final PathArgument identifier;
19
20     public WritableInteriorNode(PathArgument identifier, Map<PathArgument, WriteableModificationNode> children) {
21         super(children);
22         this.identifier = Preconditions.checkNotNull(identifier);
23     }
24
25     @Override
26     public PathArgument getIdentifier() {
27         return identifier;
28     }
29
30     @Override
31     WriteCursorStrategy createOperation(DOMDataTreeWriteCursor parentCursor) {
32         return new WriteableNodeOperation(this, parentCursor) {
33             @Override
34             public void exit() {
35                 // We are not root, so we can safely exit our level.
36                 getCursor().exit();
37             }
38         };
39     }
40
41 }