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
8 package org.opendaylight.mdsal.dom.store.inmemory;
10 import com.google.common.base.Preconditions;
11 import com.google.common.collect.ForwardingObject;
12 import java.util.Optional;
13 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModificationCursor;
18 final class DataTreeModificationCursorAdaptor extends ForwardingObject implements DOMDataTreeWriteCursor {
20 private final DataTreeModificationCursor delegate;
22 private DataTreeModificationCursorAdaptor(final DataTreeModificationCursor delegate) {
23 this.delegate = Preconditions.checkNotNull(delegate);
26 static DataTreeModificationCursorAdaptor of(final DataTreeModificationCursor dataTreeCursor) {
27 return new DataTreeModificationCursorAdaptor(dataTreeCursor);
31 protected DataTreeModificationCursor delegate() {
36 public void delete(final PathArgument child) {
37 delegate.delete(child);
41 public void enter(final PathArgument child) {
42 delegate.enter(child);
46 public void enter(final Iterable<PathArgument> path) {
51 public void enter(final PathArgument... path) {
56 public void merge(final PathArgument child, final NormalizedNode<?, ?> data) {
57 delegate.merge(child, data);
61 public void write(final PathArgument child, final NormalizedNode<?, ?> data) {
62 delegate.write(child, data);
71 public void exit(final int depth) {
75 public Optional<NormalizedNode<?, ?>> readNode(final PathArgument child) {
76 return delegate.readNode(child);