Switch to Objects.requireNonNull
[mdsal.git] / entityownership / mdsal-eos-binding-adapter / src / main / java / org / opendaylight / mdsal / eos / binding / dom / adapter / BindingEntityOwnershipCandidateRegistration.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.Entity;
13 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipCandidateRegistration;
14 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipCandidateRegistration;
15 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
16
17 /**
18  * Implementation of EntityOwnershipCandidateRegistration whose instances are returned from the
19  * {@link BindingDOMEntityOwnershipServiceAdapter}.
20  *
21  * @author Thomas Pantelis
22  */
23 class BindingEntityOwnershipCandidateRegistration extends AbstractObjectRegistration<Entity>
24            implements EntityOwnershipCandidateRegistration {
25     private final DOMEntityOwnershipCandidateRegistration domRegistration;
26
27     BindingEntityOwnershipCandidateRegistration(DOMEntityOwnershipCandidateRegistration domRegistration,
28             Entity entity) {
29         super(entity);
30         this.domRegistration = requireNonNull(domRegistration);
31     }
32
33     @Override
34     protected void removeRegistration() {
35         domRegistration.close();
36     }
37 }