Move and split EntityOwnershipService common-api
[mdsal.git] / entityownership / mdsal-eos-common-spi / src / main / java / org / opendaylight / mdsal / common / api / clustering / AbstractGenericEntityOwnershipListenerRegistration.java
1 /*
2  * Copyright (c) 2016 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
9 package org.opendaylight.mdsal.common.api.clustering;
10
11 import com.google.common.base.Preconditions;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
14 import org.opendaylight.yangtools.concepts.Path;
15
16 /**
17  * Abstract base class for an {@link GenericEntityOwnershipListenerRegistration}
18  *
19  * @param <P> the instance identifier path type
20  * @param <L> the GenericEntityOwnershipListener type
21  */
22 public abstract class AbstractGenericEntityOwnershipListenerRegistration<P extends Path<P>, L extends GenericEntityOwnershipListener<P, ? extends GenericEntityOwnershipChange<P, ? extends GenericEntity<P>>>>
23         extends AbstractObjectRegistration<L>
24         implements GenericEntityOwnershipListenerRegistration<P, L> {
25
26     private final String entityType;
27
28     protected AbstractGenericEntityOwnershipListenerRegistration(@Nonnull final L instance,
29             @Nonnull final String entityType) {
30         super(instance);
31         this.entityType = Preconditions.checkNotNull(entityType, "entityType cannot be null");
32     }
33
34     @Override
35     public String getEntityType() {
36         return entityType;
37     }
38
39 }