Migrate entity ownership to JDT annotations
[mdsal.git] / entityownership / mdsal-eos-common-spi / src / main / java / org / opendaylight / mdsal / eos / common / spi / 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 package org.opendaylight.mdsal.eos.common.spi;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.eos.common.api.GenericEntity;
14 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipChange;
15 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipListener;
16 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipListenerRegistration;
17 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
18 import org.opendaylight.yangtools.concepts.Path;
19
20 /**
21  * Abstract base class for an {@link GenericEntityOwnershipListenerRegistration}.
22  *
23  * @param <P> the instance identifier path type
24  * @param <L> the GenericEntityOwnershipListener type
25  */
26 public abstract class AbstractGenericEntityOwnershipListenerRegistration<P extends Path<P>,
27     L extends GenericEntityOwnershipListener<P, ? extends GenericEntityOwnershipChange<P, ? extends GenericEntity<P>>>>
28         extends AbstractObjectRegistration<L>
29         implements GenericEntityOwnershipListenerRegistration<P, L> {
30
31     private final @NonNull String entityType;
32
33     protected AbstractGenericEntityOwnershipListenerRegistration(@NonNull final L instance,
34             @NonNull final String entityType) {
35         super(instance);
36         this.entityType = requireNonNull(entityType, "entityType cannot be null");
37     }
38
39     @Override
40     public String getEntityType() {
41         return entityType;
42     }
43
44 }