2 * Copyright (c) 2016 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
9 package org.opendaylight.mdsal.dom.store.inmemory;
11 import com.google.common.base.Optional;
12 import com.google.common.base.Preconditions;
13 import com.google.common.collect.ForwardingObject;
14 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModificationCursor;
19 final class DataTreeModificationCursorAdaptor extends ForwardingObject implements DOMDataTreeWriteCursor {
21 private final DataTreeModificationCursor delegate;
23 private DataTreeModificationCursorAdaptor(final DataTreeModificationCursor delegate) {
24 this.delegate = Preconditions.checkNotNull(delegate);
27 static DataTreeModificationCursorAdaptor of(final DataTreeModificationCursor dataTreeCursor) {
28 return new DataTreeModificationCursorAdaptor(dataTreeCursor);
32 protected DataTreeModificationCursor delegate() {
37 public void delete(final PathArgument child) {
38 delegate.delete(child);
42 public void enter(final PathArgument child) {
43 delegate.enter(child);
47 public void enter(final Iterable<PathArgument> path) {
52 public void enter(final PathArgument... path) {
57 public void merge(final PathArgument child, final NormalizedNode<?, ?> data) {
58 delegate.merge(child, data);
62 public void write(final PathArgument child, final NormalizedNode<?, ?> data) {
63 delegate.write(child, data);
72 public void exit(final int depth) {
76 public Optional<NormalizedNode<?, ?>> readNode(final PathArgument child) {
77 return delegate.readNode(child);