Split out AbstractBindingAdapter
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / main / java / org / opendaylight / mdsal / binding / dom / adapter / BindingDataTreeChangeListenerRegistration.java
1 /*
2  * Copyright (c) 2015 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.binding.dom.adapter;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
12 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
13 import org.opendaylight.yangtools.concepts.ListenerRegistration;
14
15 class BindingDataTreeChangeListenerRegistration<L extends DataTreeChangeListener<?>>
16         extends AbstractListenerRegistration<L> {
17
18     private final ListenerRegistration<?> domReg;
19
20     BindingDataTreeChangeListenerRegistration(final L listener, final ListenerRegistration<?> domReg) {
21         super(listener);
22         this.domReg = Preconditions.checkNotNull(domReg);
23     }
24
25     @Override
26     protected void removeRegistration() {
27         domReg.close();
28     }
29 }