+++ /dev/null
-/*
- * 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.dom.api;
-
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-
-/**
- * A registration of a {@link DOMNotificationListener}. Invoking {@link #close()} will prevent further
- * delivery of events to the listener.
- */
-public interface DOMNotificationListenerRegistration extends ListenerRegistration<DOMNotificationListener> {
-
-}
import java.util.Collection;
import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
/**
* null or a SchemaPath which does not represent a valid {@link DOMNotification} type.
* @throws NullPointerException if either of the arguments is null
*/
- DOMNotificationListenerRegistration registerNotificationListener(@Nonnull DOMNotificationListener listener, @Nonnull Collection<SchemaPath> types);
+ <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(@Nonnull T listener, @Nonnull Collection<SchemaPath> types);
/**
* Register a {@link DOMNotificationListener} to receive a set of notifications. As with
* @throws NullPointerException if listener is null
*/
// FIXME: Java 8: provide a default implementation of this method.
- DOMNotificationListenerRegistration registerNotificationListener(@Nonnull DOMNotificationListener listener, SchemaPath... types);
+ <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(@Nonnull T listener, SchemaPath... types);
}
+++ /dev/null
-/*
- * 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.dom.spi;
-
-import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
-import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListenerRegistration;
-import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
-
-/**
- * Utility base class for {@link DOMNotificationListenerRegistration}
- * implementations.
- */
-public abstract class AbstractDOMNotificationListenerRegistration extends AbstractListenerRegistration<DOMNotificationListener> implements DOMNotificationListenerRegistration {
- /**
- * Default constructor. Subclasses need to invoke it from their
- * constructor(s).
- *
- * @param listener {@link DOMNotificationListener} instance which is
- * being held by this registration. May not be null.
- */
- protected AbstractDOMNotificationListenerRegistration(final @Nonnull DOMNotificationListener listener) {
- super(listener);
- }
-}
import com.google.common.collect.ForwardingObject;
import java.util.Collection;
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
-import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListenerRegistration;
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
/**
protected abstract DOMNotificationService delegate();
@Override
- public DOMNotificationListenerRegistration registerNotificationListener(final DOMNotificationListener listener,
+ public <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener,
final Collection<SchemaPath> types) {
return delegate().registerNotificationListener(listener, types);
}
@Override
- public DOMNotificationListenerRegistration registerNotificationListener(final DOMNotificationListener listener,
+ public <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener,
final SchemaPath... types) {
return delegate().registerNotificationListener(listener, types);
}