2 * Copyright (c) 2013 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.sal.binding.impl;
10 import org.opendaylight.controller.sal.binding.api.NotificationListener;
11 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
12 import org.opendaylight.yangtools.concepts.ListenerRegistration;
13 import org.opendaylight.yangtools.yang.binding.Notification;
15 import com.google.common.base.Preconditions;
17 class GenericNotificationRegistration<T extends Notification> extends AbstractObjectRegistration<NotificationListener<T>> implements ListenerRegistration<NotificationListener<T>> {
18 private final Class<T> type;
19 private NotificationBrokerImpl notificationBroker;
21 public GenericNotificationRegistration(final Class<T> type, final NotificationListener<T> instance, final NotificationBrokerImpl broker) {
23 this.type = Preconditions.checkNotNull(type);
24 this.notificationBroker = Preconditions.checkNotNull(broker);
27 public Class<T> getType() {
32 protected void removeRegistration() {
33 notificationBroker.unregisterListener(this);
34 notificationBroker = null;