Deprecate Clustered(DOM)DataTreeChangeListener
[mdsal.git] / binding / mdsal-binding-spi / src / main / java / org / opendaylight / mdsal / binding / spi / ForwardingDataBroker.java
1 /*
2  * Copyright © 2017, 2018 Red Hat, Inc. and others.
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.binding.spi;
9
10 import com.google.common.collect.ForwardingObject;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.mdsal.binding.api.DataBroker;
13 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
14 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
15 import org.opendaylight.mdsal.binding.api.ReadTransaction;
16 import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
17 import org.opendaylight.mdsal.binding.api.TransactionChain;
18 import org.opendaylight.mdsal.binding.api.WriteTransaction;
19 import org.opendaylight.yangtools.concepts.Registration;
20 import org.opendaylight.yangtools.yang.binding.DataObject;
21
22 /**
23  * Utility {@link DataBroker} implementation which forwards all interface method invocation to a delegate instance.
24  */
25 public abstract class ForwardingDataBroker extends ForwardingObject implements DataBroker {
26     @Override
27     protected abstract @NonNull DataBroker delegate();
28
29     @Override
30     public ReadTransaction newReadOnlyTransaction() {
31         return delegate().newReadOnlyTransaction();
32     }
33
34     @Override
35     public ReadWriteTransaction newReadWriteTransaction() {
36         return delegate().newReadWriteTransaction();
37     }
38
39     @Override
40     public WriteTransaction newWriteOnlyTransaction() {
41         return delegate().newWriteOnlyTransaction();
42     }
43
44     @Override
45     public TransactionChain createTransactionChain() {
46         return delegate().createTransactionChain();
47     }
48
49     @Override
50     public TransactionChain createMergingTransactionChain() {
51         return delegate().createMergingTransactionChain();
52     }
53
54     @Override
55     public <T extends DataObject> Registration registerTreeChangeListener(final DataTreeIdentifier<T> treeId,
56             final DataTreeChangeListener<T> listener) {
57         return delegate().registerTreeChangeListener(treeId, listener);
58     }
59
60     @Override
61     @Deprecated(since = "13.0.0", forRemoval = true)
62     public <T extends DataObject> Registration registerLegacyTreeChangeListener(final DataTreeIdentifier<T> treeId,
63         final DataTreeChangeListener<T> listener) {
64         return delegate().registerLegacyTreeChangeListener(treeId, listener);
65     }
66 }