Seal BaseNotification 03/100803/4
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 25 Apr 2022 19:26:06 +0000 (21:26 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 25 Apr 2022 20:29:53 +0000 (22:29 +0200)
BaseNotification should never be used directly, only through
Notification and InstanceNotification.

Change-Id: Ib3fd70aeb364523d7f630eb6e882f2308e427884
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/BaseNotification.java
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/InstanceNotification.java
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Notification.java

index a445e418b265696dd4bd7ca20ae3ea602cad8a1b..3784f45a44dd491947e542b58205b386b0c40099 100644 (file)
@@ -12,6 +12,6 @@ package org.opendaylight.yangtools.yang.binding;
  * only to tie together semantics of global notifications (as represented by {@link Notification}) and instance
  * notifications (as represented by {@link InstanceNotification}.
  */
-public interface BaseNotification extends DataContainer {
+public sealed interface BaseNotification extends DataContainer permits Notification, InstanceNotification {
 
 }
index 83fd1c88068a3c7a03d2bea10fad56b3c3cf6670..82becf3a8cc2d14aa4070f93be36d69ff9974daa 100644 (file)
@@ -19,9 +19,8 @@ import org.eclipse.jdt.annotation.NonNull;
  * @param <T> Parent data tree instance type
  */
 @Beta
-public interface InstanceNotification<N extends InstanceNotification<N, T>, T extends DataObject>
+public non-sealed interface InstanceNotification<N extends InstanceNotification<N, T>, T extends DataObject>
         extends BaseNotification {
-
     @Override
     @NonNull Class<N> implementedInterface();
 }
index 6acaa44d20c635149dd66a647bab4659cac84dee..962cb88946d0e30a74aca5ef3d371e4aa9756b03 100644 (file)
@@ -13,7 +13,7 @@ package org.opendaylight.yangtools.yang.binding;
  * interface. In case they do, {@link EventInstantAware#eventInstant()} returns the time when this notification was
  * generated.
  */
-public interface Notification<T extends Notification<T> & DataObject> extends BaseNotification {
+public non-sealed interface Notification<T extends Notification<T> & DataObject> extends BaseNotification {
     @Override
     Class<T> implementedInterface();
 }