/* * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.md.sal.binding.compat; import static java.util.Objects.requireNonNull; import org.opendaylight.controller.sal.binding.api.NotificationListener; import org.opendaylight.yangtools.concepts.AbstractListenerRegistration; import org.opendaylight.yangtools.yang.binding.Notification; /** * Abstract implementation of {@link NotificationListenerRegistration}. * * @param Notification type */ @Deprecated(forRemoval = true) abstract class AbstractNotificationListenerRegistration extends AbstractListenerRegistration> implements NotificationListenerRegistration { private final Class type; protected AbstractNotificationListenerRegistration(final Class type, final NotificationListener listener) { super(listener); this.type = requireNonNull(type); } @Override public Class getType() { return type; } @Override @SuppressWarnings("unchecked") public void notify(final Notification notification) { if (!isClosed()) { getInstance().onNotification((T)notification); } } }