Switch to Objects.requireNonNull
[mdsal.git] / entityownership / mdsal-eos-binding-adapter / src / main / java / org / opendaylight / mdsal / eos / binding / dom / adapter / BindingEntityOwnershipListenerRegistration.java
1 /*
2  * Copyright (c) 2015 Brocade Communications 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.eos.binding.dom.adapter;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipListener;
13 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipListenerRegistration;
14 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListenerRegistration;
15 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
16
17 /**
18  * Implementation of EntityOwnershipListenerRegistration whose instances are returned from the
19  * {@link BindingDOMEntityOwnershipServiceAdapter}.
20  *
21  * @author Thomas Pantelis
22  */
23 class BindingEntityOwnershipListenerRegistration extends AbstractObjectRegistration<EntityOwnershipListener>
24         implements EntityOwnershipListenerRegistration {
25     private final String entityType;
26     private final DOMEntityOwnershipListenerRegistration domRegistration;
27
28     BindingEntityOwnershipListenerRegistration(String entityType, EntityOwnershipListener listener,
29             DOMEntityOwnershipListenerRegistration domRegistration) {
30         super(listener);
31         this.entityType = requireNonNull(entityType);
32         this.domRegistration = requireNonNull(domRegistration);
33     }
34
35     @Override
36     public String getEntityType() {
37         return entityType;
38     }
39
40     @Override
41     protected void removeRegistration() {
42         domRegistration.close();
43     }
44 }