Enable spotbugs in mdsal-{binding,dom}-spi
[mdsal.git] / dom / mdsal-dom-spi / src / main / java / org / opendaylight / mdsal / dom / spi / shard / 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 package org.opendaylight.mdsal.dom.spi.shard;
9
10 import static java.util.Objects.requireNonNull;
11
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     WritableInteriorNode(final PathArgument identifier, final Map<PathArgument, WriteableModificationNode> children) {
21         super(children);
22         this.identifier = requireNonNull(identifier);
23     }
24
25     @Override
26     public PathArgument getIdentifier() {
27         return identifier;
28     }
29
30     @Override
31     public WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor) {
32         return new WritableNodeOperation(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 }