onNotification(notification.getType(), verifyNotNull(deserialize(notification)));
}
- abstract void onNotification(@NonNull Absolute domType, @NonNull Notification notification);
+ abstract void onNotification(@NonNull Absolute domType, @NonNull Notification<?> notification);
abstract Set<Absolute> getSupportedNotifications();
- private Notification deserialize(final DOMNotification notification) {
+ private Notification<?> deserialize(final DOMNotification notification) {
if (notification instanceof LazySerializedDOMNotification) {
// TODO: This is a routed-back notification, for which we may end up losing event time here, but that is
// okay, for now at least.
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.dom.adapter.invoke.NotificationListenerInvoker;
import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.yangtools.yang.binding.Notification;
final class BindingDOMNotificationListenerAdapter extends AbstractDOMNotificationListenerAdapter {
private final ImmutableMap<Absolute, NotificationListenerInvoker> invokers;
- private final NotificationListener delegate;
+ private final @NonNull NotificationListener delegate;
BindingDOMNotificationListenerAdapter(final AdapterContext adapterContext, final NotificationListener delegate) {
super(adapterContext);
}
@Override
- void onNotification(final Absolute domType, final Notification notification) {
+ void onNotification(final Absolute domType, final Notification<?> notification) {
invokers.get(domType).invokeNotification(delegate, domType.lastNodeIdentifier(), notification);
}
}
@Override
- public void putNotification(final Notification notification) throws InterruptedException {
+ public void putNotification(final Notification<?> notification) throws InterruptedException {
getDelegate().putNotification(toDomNotification(notification));
}
@Override
- public ListenableFuture<? extends Object> offerNotification(final Notification notification) {
+ public ListenableFuture<? extends Object> offerNotification(final Notification<?> notification) {
ListenableFuture<?> offerResult = getDelegate().offerNotification(toDomNotification(notification));
return DOMNotificationPublishService.REJECTED.equals(offerResult)
? NotificationPublishService.REJECTED
}
@Override
- public ListenableFuture<? extends Object> offerNotification(final Notification notification,
- final int timeout, final TimeUnit unit) throws InterruptedException {
+ public ListenableFuture<? extends Object> offerNotification(final Notification<?> notification, final int timeout,
+ final TimeUnit unit) throws InterruptedException {
ListenableFuture<?> offerResult = getDelegate().offerNotification(toDomNotification(notification), timeout,
unit);
return DOMNotificationPublishService.REJECTED.equals(offerResult)
: offerResult;
}
- private @NonNull DOMNotification toDomNotification(final Notification notification) {
+ private @NonNull DOMNotification toDomNotification(final Notification<?> notification) {
final Instant instant = notification instanceof EventInstantAware
? ((EventInstantAware) notification).eventInstant() : Instant.now();
return LazySerializedDOMNotification.create(currentSerializer(), notification, instant);
});
private final @NonNull BindingNormalizedNodeSerializer codec;
- private final @NonNull Notification data;
+ private final @NonNull Notification<?> data;
private final @NonNull Absolute type;
private final @NonNull Instant eventInstant;
private volatile ContainerNode domBody;
- LazySerializedDOMNotification(final BindingNormalizedNodeSerializer codec, final Notification data,
+ LazySerializedDOMNotification(final BindingNormalizedNodeSerializer codec, final Notification<?> data,
final Absolute type, final Instant eventInstant) {
this.codec = requireNonNull(codec);
this.data = requireNonNull(data);
this.eventInstant = requireNonNull(eventInstant);
}
- static @NonNull DOMNotification create(final BindingNormalizedNodeSerializer codec, final Notification data,
+ static @NonNull DOMNotification create(final BindingNormalizedNodeSerializer codec, final Notification<?> data,
final Instant eventInstant) {
final Absolute type = PATHS.getUnchecked(data.implementedInterface());
return new LazySerializedDOMNotification(codec, data, type, eventInstant);
return eventInstant;
}
- @NonNull Notification getBindingData() {
+ @NonNull Notification<?> getBindingData() {
return data;
}
}
}
@Override
- void onNotification(final Absolute domType, final Notification notification) {
+ void onNotification(final Absolute domType, final Notification<?> notification) {
executor.execute(() -> delegate.onNotification(type.cast(notification)));
}
}
@Override
- public void putNotification(final Notification notification) throws InterruptedException {
+ public void putNotification(final Notification<?> notification) throws InterruptedException {
delegate().putNotification(notification);
}
@Override
- public ListenableFuture<? extends Object> offerNotification(final Notification notification) {
+ public ListenableFuture<? extends Object> offerNotification(final Notification<?> notification) {
return delegate().offerNotification(notification);
}
@Override
- public ListenableFuture<? extends Object> offerNotification(final Notification notification, final int timeout,
+ public ListenableFuture<? extends Object> offerNotification(final Notification<?> notification, final int timeout,
final TimeUnit unit) throws InterruptedException {
return delegate().offerNotification(notification, timeout, unit);
}
import java.lang.invoke.WrongMethodTypeException;
import org.junit.Test;
import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.opendaylight.yangtools.yang.binding.NotificationListener;
import org.opendaylight.yangtools.yang.common.QName;
void onTestNotificationInterface(TestNotificationInterface notif);
}
- public interface TestNotificationInterface extends Notification {
+ public interface TestNotificationInterface extends DataObject, Notification<TestNotificationInterface> {
QName QNAME = QName.create("test", "test");
}
}
\ No newline at end of file