2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.md.sal.binding.compat;
10 import static java.util.Objects.requireNonNull;
12 import org.opendaylight.controller.sal.binding.api.NotificationListener;
13 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
14 import org.opendaylight.yangtools.yang.binding.Notification;
17 * Abstract implementation of {@link NotificationListenerRegistration}.
19 * @param <T> Notification type
21 @Deprecated(forRemoval = true)
22 abstract class AbstractNotificationListenerRegistration<T extends Notification>
23 extends AbstractListenerRegistration<NotificationListener<T>> implements NotificationListenerRegistration<T> {
24 private final Class<? extends Notification> type;
26 protected AbstractNotificationListenerRegistration(final Class<? extends Notification> type,
27 final NotificationListener<T> listener) {
29 this.type = requireNonNull(type);
33 public Class<? extends Notification> getType() {
38 @SuppressWarnings("unchecked")
39 public void notify(final Notification notification) {
41 getInstance().onNotification((T)notification);