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);
31 protected final 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 merge(final PathArgument child, final NormalizedNode<?, ?> data) {
47 delegate.merge(child, data);
51 public void write(final PathArgument child, final NormalizedNode<?, ?> data) {
52 delegate.write(child, data);
56 public void enter(final Iterable<PathArgument> path) {
66 public void exit(final int depth) {
70 public Optional<NormalizedNode<?, ?>> readNode(final PathArgument child) {
71 return delegate.readNode(child);
80 public void enter(final PathArgument... path) {