X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding%2Fmdsal-binding-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fapi%2FDataTreeChangeListener.java;h=6a0a26568f12cb8dbf6a992c39c093b529fa3b0d;hb=refs%2Fchanges%2F65%2F100665%2F1;hp=2dc28988a10b055a3bb61399fbd6c43505621b35;hpb=104afbbc04792df68ee001c14fb02171d640f889;p=mdsal.git diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeListener.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeListener.java index 2dc28988a1..6a0a26568f 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeListener.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeListener.java @@ -9,7 +9,7 @@ package org.opendaylight.mdsal.binding.api; import java.util.Collection; import java.util.EventListener; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.binding.DataObject; /** @@ -28,6 +28,9 @@ public interface DataTreeChangeListener extends EventListe * path. This initial event will contain all pre-existing data as created. * *

+ * Note: If there is no pre-existing data, the method {@link #onInitialData} will be invoked. + * + *

* A data change event may be triggered spuriously, e.g. such that data before * and after compare as equal. Implementations of this interface are expected * to recover from such events. Event producers are expected to exert reasonable @@ -40,5 +43,19 @@ public interface DataTreeChangeListener extends EventListe * * @param changes Collection of change events, may not be null or empty. */ - void onDataTreeChanged(@Nonnull Collection> changes); + void onDataTreeChanged(@NonNull Collection> changes); + + /** + * Invoked only once during registration of the listener if there was no data in the conceptual data tree + * for the supplied path, which was used to register this listener, and after this + * {@link #onDataTreeChanged(Collection)} would always be invoked for data changes. + * + *

+ * Default implementation does nothing and is appropriate for users who do not care about ascertaining + * initial state. + */ + // FIXME: 8.0.0: this method should be non-default + default void onInitialData() { + //no-op + } }