Migrate mdsal-binding-api to JDT annotations 36/76736/6
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Oct 2018 10:35:44 +0000 (12:35 +0200)
committerJie Han <han.jie@zte.com.cn>
Tue, 9 Oct 2018 01:44:21 +0000 (01:44 +0000)
This removes the use of javax.annotation nullable annotations
to remove import-package. Since we are using @CheckReturnValue
we also need to explicitly remove javax.annotation import.

JIRA: MDSAL-373
Change-Id: I2c18495a5082fb79a61278580c67ec3a21b979af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 files changed:
binding/mdsal-binding-api/pom.xml
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/CursorAwareWriteTransaction.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataObjectModification.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeListener.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeService.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCommitCohort.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursor.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursorProvider.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeIdentifier.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListener.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListeningException.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeLoopException.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeModification.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducer.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerBusyException.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerException.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerFactory.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeService.java

index a2c1a2d286872fb5c19b942dde6bfb5fcac3310e..a96333092f4cf63010f04f60c1ac88e1a1ed4975 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 7c024a864b97b8201d2cf47626e8d2c9015f25af..46d5c5d4278c2836736706ddd1899c8dadd2ee4e 100644 (file)
@@ -9,8 +9,6 @@
 package org.opendaylight.mdsal.binding.api;
 
 import com.google.common.util.concurrent.FluentFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
@@ -20,7 +18,6 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * Write transaction that provides cursor's with write access to the data tree.
  */
 public interface CursorAwareWriteTransaction extends DataTreeCursorProvider {
-
     /**
      * Create a {@link DataTreeWriteCursor} anchored at the specified path.
      * There can only be one cursor open at a time.
@@ -30,9 +27,8 @@ public interface CursorAwareWriteTransaction extends DataTreeCursorProvider {
      * @return write cursor at the desired location.
      * @throws IllegalStateException when there's an open cursor, or this transaction is closed already.
      */
-    @Nullable
     @Override
-    <T extends DataObject> DataTreeWriteCursor createCursor(@Nonnull DataTreeIdentifier<T> path);
+    <T extends DataObject> DataTreeWriteCursor createCursor(DataTreeIdentifier<T> path);
 
     /**
      * Cancels the transaction.
index fc4bb4ee4a85e6ee42e726d48f989e02a1874a00..1236bc8cdefbaf9f9c524cb955a398a5c60ebfe6 100644 (file)
@@ -5,12 +5,11 @@
  * 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.mdsal.binding.api;
 
 import java.util.Collection;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.ChoiceIn;
@@ -54,14 +53,14 @@ public interface DataObjectModification<T extends DataObject> extends
      *
      * @return type of modified object.
      */
-    @Nonnull Class<T> getDataType();
+    @NonNull Class<T> getDataType();
 
     /**
      * Returns type of modification.
      *
      * @return type Type of performed modification.
      */
-    @Nonnull ModificationType getModificationType();
+    @NonNull ModificationType getModificationType();
 
     /**
      * Returns before-state of top level container. Implementations are encouraged, but not required
@@ -84,7 +83,7 @@ public interface DataObjectModification<T extends DataObject> extends
      *
      * @return unmodifiable collection of modified direct children.
      */
-    @Nonnull Collection<? extends DataObjectModification<? extends DataObject>> getModifiedChildren();
+    @NonNull Collection<? extends DataObjectModification<? extends DataObject>> getModifiedChildren();
 
     /**
      * Returns child list item modification if {@code child} was modified by this modification.
@@ -95,7 +94,7 @@ public interface DataObjectModification<T extends DataObject> extends
      *         to generated model.
      */
     <C extends ChildOf<? super T>> Collection<DataObjectModification<C>> getModifiedChildren(
-            @Nonnull Class<C> childType);
+            @NonNull Class<C> childType);
 
     /**
      * Returns child list item modification if {@code child} was modified by this modification. This method should be
@@ -108,7 +107,7 @@ public interface DataObjectModification<T extends DataObject> extends
      *         to generated model.
      */
     <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>>
-            getModifiedChildren(@Nonnull Class<H> caseType, @Nonnull Class<C> childType);
+            getModifiedChildren(@NonNull Class<H> caseType, @NonNull Class<C> childType);
 
     /**
      * Returns container child modification if {@code child} was modified by this modification. This method should be
@@ -123,8 +122,8 @@ public interface DataObjectModification<T extends DataObject> extends
      * @throws IllegalArgumentException If supplied {@code child} class is not valid child according
      *         to generated model.
      */
-    @Nullable <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C>
-            getModifiedChildContainer(@Nonnull Class<H> caseType, @Nonnull Class<C> child);
+    <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>> @Nullable DataObjectModification<C>
+            getModifiedChildContainer(@NonNull Class<H> caseType, @NonNull Class<C> child);
 
     /**
      * Returns container child modification if {@code child} was modified by this
@@ -138,8 +137,8 @@ public interface DataObjectModification<T extends DataObject> extends
      * @throws IllegalArgumentException If supplied {@code child} class is not valid child according
      *         to generated model.
      */
-    @Nullable <C extends ChildOf<? super T>> DataObjectModification<C> getModifiedChildContainer(
-            @Nonnull Class<C> child);
+    <C extends ChildOf<? super T>> @Nullable DataObjectModification<C> getModifiedChildContainer(
+            @NonNull Class<C> child);
 
     /**
      * Returns augmentation child modification if {@code augmentation} was modified by this modification.
@@ -152,8 +151,8 @@ public interface DataObjectModification<T extends DataObject> extends
      * @throws IllegalArgumentException If supplied {@code augmentation} class is not valid augmentation
      *         according to generated model.
      */
-    @Nullable <C extends Augmentation<T> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-            @Nonnull Class<C> augmentation);
+    <C extends Augmentation<T> & DataObject> @Nullable DataObjectModification<C> getModifiedAugmentation(
+            @NonNull Class<C> augmentation);
 
     /**
      * Returns child list item modification if {@code child} was modified by this modification.
@@ -165,7 +164,7 @@ public interface DataObjectModification<T extends DataObject> extends
      *         to generated model.
      */
     <N extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<N>> DataObjectModification<N>
-            getModifiedChildListItem(@Nonnull Class<N> listItem, @Nonnull  K listKey);
+            getModifiedChildListItem(@NonNull Class<N> listItem, @NonNull K listKey);
 
     /**
      * Returns child list item modification if {@code child} was modified by this modification.
@@ -177,8 +176,8 @@ public interface DataObjectModification<T extends DataObject> extends
      *         to generated model.
      */
     <H extends ChoiceIn<? super T> & DataObject, C extends Identifiable<K> & ChildOf<? super H>,
-            K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(@Nonnull Class<H> caseType,
-                    @Nonnull Class<C> listItem, @Nonnull  K listKey);
+            K extends Identifier<C>> @Nullable DataObjectModification<C> getModifiedChildListItem(
+                    @NonNull Class<H> caseType, @NonNull Class<C> listItem, @NonNull K listKey);
 
     /**
      * Returns a child modification if a node identified by {@code childArgument} was modified by this modification.
@@ -190,5 +189,4 @@ public interface DataObjectModification<T extends DataObject> extends
      *         generated model.
      */
     @Nullable DataObjectModification<? extends DataObject> getModifiedChild(PathArgument childArgument);
-
 }
index 2dc28988a10b055a3bb61399fbd6c43505621b35..b6ae850e36945996b615461db125fc7dd2efae0b 100644 (file)
@@ -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;
 
 /**
@@ -40,5 +40,5 @@ public interface DataTreeChangeListener<T extends DataObject> extends EventListe
      *
      * @param changes Collection of change events, may not be null or empty.
      */
-    void onDataTreeChanged(@Nonnull Collection<DataTreeModification<T>> changes);
+    void onDataTreeChanged(@NonNull Collection<DataTreeModification<T>> changes);
 }
index aae09b4886c695296b1b32bfccae7c82af87efda..6558ec8b273f77cc6d4c5dd65ac47abe5fa24f6a 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.mdsal.binding.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
@@ -53,6 +53,6 @@ public interface DataTreeChangeService extends BindingService {
      *         your listener using {@link ListenerRegistration#close()} to stop
      *         delivery of change events.
      */
-    @Nonnull <T extends DataObject,L extends DataTreeChangeListener<T>> ListenerRegistration<L>
-            registerDataTreeChangeListener(@Nonnull DataTreeIdentifier<T> treeId, @Nonnull L listener);
+    <T extends DataObject, L extends DataTreeChangeListener<T>> @NonNull ListenerRegistration<L>
+            registerDataTreeChangeListener(@NonNull DataTreeIdentifier<T> treeId, @NonNull L listener);
 }
\ No newline at end of file
index f72c11b9b2a99e193f03fc7d3b7925289dc31d2d..abc8aa84b8de3988bafefa5d6cdd5934af52dbfb 100644 (file)
@@ -5,13 +5,12 @@
  * 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.mdsal.binding.api;
 
 import com.google.common.annotations.Beta;
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.DataValidationFailedException;
 import org.opendaylight.mdsal.common.api.PostCanCommitStep;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -67,11 +66,9 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * TODO: Provide example and describe more usage patterns
  *
  * @author Tony Tkacik &lt;ttkacik@cisco.com&gt;
- *
  */
 @Beta
 public interface DataTreeCommitCohort<T extends DataObject> {
-
     /**
      * Validates the supplied data tree modifications and associates the cohort-specific steps with data broker
      * transaction.
@@ -103,7 +100,6 @@ public interface DataTreeCommitCohort<T extends DataObject> {
      *         more specific subclasses of this exception to provide additional information about
      *         validation failure reason.
      */
-    FluentFuture<PostCanCommitStep> canCommit(@Nonnull Object txId,
-            @Nonnull Collection<DataTreeModification<T>> modifications);
-
+    FluentFuture<PostCanCommitStep> canCommit(@NonNull Object txId,
+            @NonNull Collection<DataTreeModification<T>> modifications);
 }
index 84895acba5b1589b7b3b32faff912685ea01486a..1560216b0e34cee70ebbfca4ff5652e51b7b9ad5 100644 (file)
@@ -5,19 +5,17 @@
  * 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.mdsal.binding.api;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
 
-
 /**
- * A cursor holding a logical position within a conceptual data tree. It allows operations relative
- * to that position, as well as moving the position up or down the tree.
+ * A cursor holding a logical position within a conceptual data tree. It allows operations relative to that position,
+ * as well as moving the position up or down the tree.
  */
 @Beta
 @NotThreadSafe
@@ -29,7 +27,7 @@ public interface DataTreeCursor extends AutoCloseable {
      * @throws IllegalArgumentException when specified identifier does not identify a valid child,
      *         or if that child is not an instance of {@link DataContainer}.
      */
-    void enter(@Nonnull PathArgument child);
+    void enter(@NonNull PathArgument child);
 
     /**
      * Move the cursor to the specified child of the current position. This is the equivalent of
@@ -40,7 +38,7 @@ public interface DataTreeCursor extends AutoCloseable {
      * @throws IllegalArgumentException when specified path does not identify a valid child, or if
      *         that child is not an instance of {@link DataContainer}.
      */
-    void enter(@Nonnull PathArgument... path);
+    void enter(@NonNull PathArgument... path);
 
     /**
      * Move the cursor to the specified child of the current position. This is equivalent to
@@ -50,7 +48,7 @@ public interface DataTreeCursor extends AutoCloseable {
      * @throws IllegalArgumentException when specified path does not identify a valid child, or if
      *         that child is not an instance of {@link DataContainer}.
      */
-    void enter(@Nonnull Iterable<PathArgument> path);
+    void enter(@NonNull Iterable<PathArgument> path);
 
     /**
      * Move the cursor up to the parent of current position. This is equivalent of invoking
index 003afcf578f00506b63ad550e2c48565e2aa8739..f00bf495a2a120523c70c0d2f1ea1b51106e3e40 100644 (file)
@@ -5,18 +5,16 @@
  * 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.mdsal.binding.api;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 /**
  * Provides access to {#link DataTreeCursor}'s anchored at the specified path.
  */
 public interface DataTreeCursorProvider {
-
     /**
      * Create a new {@link DataTreeCursor} at specified path. May fail if specified path
      * does not exist.
@@ -26,6 +24,5 @@ public interface DataTreeCursorProvider {
      * @throws IllegalStateException if there is another cursor currently open, or the transaction
      *         is already closed (closed or submitted).
      */
-    @Nullable
-    <T extends DataObject> DataTreeCursor createCursor(@Nonnull DataTreeIdentifier<T> path);
+    <T extends DataObject> @Nullable DataTreeCursor createCursor(@NonNull DataTreeIdentifier<T> path);
 }
index 5193465864f699d719cdfde872d5cd261df89b68..c8eaaad3c1e07afbea8b0a7fa2187c7c4a8aa641 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.mdsal.binding.api;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.concepts.Path;
@@ -42,8 +42,7 @@ public final class DataTreeIdentifier<T extends DataObject> implements Immutable
      *
      * @return Logical data store type. Guaranteed to be non-null.
      */
-    @Nonnull
-    public LogicalDatastoreType getDatastoreType() {
+    public @NonNull LogicalDatastoreType getDatastoreType() {
         return datastoreType;
     }
 
@@ -52,8 +51,7 @@ public final class DataTreeIdentifier<T extends DataObject> implements Immutable
      *
      * @return Instance identifier corresponding to the root node.
      */
-    @Nonnull
-    public InstanceIdentifier<T> getRootIdentifier() {
+    public @NonNull InstanceIdentifier<T> getRootIdentifier() {
         return rootIdentifier;
     }
 
index cabcec92f46c91ca4a9a64de1705a02fb56fbeee..b432ea27083ec07e747dbb447aeec10e8a7bc24b 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.mdsal.binding.api;
 import java.util.Collection;
 import java.util.EventListener;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 /**
@@ -28,8 +28,8 @@ public interface DataTreeListener extends EventListener {
      *        This includes all the subtrees this listener is subscribed to, even those which have
      *        not changed.
      */
-    void onDataTreeChanged(@Nonnull Collection<DataTreeModification<?>> changes,
-            @Nonnull Map<DataTreeIdentifier<?>, DataObject> subtrees);
+    void onDataTreeChanged(@NonNull Collection<DataTreeModification<?>> changes,
+            @NonNull Map<DataTreeIdentifier<?>, DataObject> subtrees);
 
     /**
      * Invoked when a subtree listening failure occurs. This can be triggered, for example, when a
@@ -38,6 +38,5 @@ public interface DataTreeListener extends EventListener {
      *
      * @param causes Collection of failure causes, may not be null or empty.
      */
-    void onDataTreeFailed(@Nonnull Collection<DataTreeListeningException> causes);
-
+    void onDataTreeFailed(@NonNull Collection<DataTreeListeningException> causes);
 }
\ No newline at end of file
index 2a05c62c919456ab15ca15ff5cdddb303ae70918..4f67838ba4e00d61de1592048103af5b9babf39a 100644 (file)
@@ -7,24 +7,23 @@
  */
 package org.opendaylight.mdsal.binding.api;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
- * Base exception for various causes why and {@link DataTreeListener} may be terminated by the
- * {@link DataTreeService} implementation.
+ * Base exception for various causes why and {@link DataTreeListener} may be terminated by the {@link DataTreeService}
+ * implementation.
  */
 public class DataTreeListeningException extends Exception {
-
-
     private static final long serialVersionUID = 1L;
 
-    public DataTreeListeningException(@Nonnull String message, @Nullable Throwable cause) {
-        super(Preconditions.checkNotNull(message, "message"), cause);
+    public DataTreeListeningException(final @NonNull String message, final @Nullable Throwable cause) {
+        super(requireNonNull(message, "message"), cause);
     }
 
-    public DataTreeListeningException(@Nonnull String message) {
-        super(Preconditions.checkNotNull(message, "message"));
+    public DataTreeListeningException(@NonNull final String message) {
+        super(requireNonNull(message, "message"));
     }
 }
\ No newline at end of file
index 326349d5765758ff560d7cbe5012edb4b4f3c7d2..cfa86c71912bd6ccef296e279579c31d3d429f94 100644 (file)
@@ -7,21 +7,20 @@
  */
 package org.opendaylight.mdsal.binding.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
- * Exception thrown when a loop is detected in the way {@link DataTreeListener} and
- * {@link DataTreeProducer} instances would be connected.
+ * Exception thrown when a loop is detected in the way {@link DataTreeListener} and {@link DataTreeProducer} instances
+ * would be connected.
  */
 public class DataTreeLoopException extends DataTreeProducerException {
-
     private static final long serialVersionUID = 1L;
 
-    public DataTreeLoopException(@Nonnull final String message, @Nonnull final Throwable cause) {
+    public DataTreeLoopException(final @NonNull String message, final @NonNull Throwable cause) {
         super(message, cause);
     }
 
-    public DataTreeLoopException(@Nonnull final String message) {
+    public DataTreeLoopException(final @NonNull String message) {
         super(message);
     }
 
index 2899ef6cb2fb55f7790bc34900bb06262d41bd2b..3b85bf55b587c8cb33ad041ba42a1135b31a9783 100644 (file)
@@ -5,33 +5,29 @@
  * 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.mdsal.binding.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 /**
  * Represent root of modification.
  *
  * @author Tony Tkacik &lt;ttkacik@cisco.com&gt;
- *
  */
 public interface DataTreeModification<T extends DataObject> {
-
     /**
-     * Get the modification root path. This is the path of the root node
-     * relative to the root of InstanceIdentifier namespace.
+     * Get the modification root path. This is the path of the root node relative to the root of InstanceIdentifier
+     * namespace.
      *
      * @return absolute path of the root node
      */
-    @Nonnull DataTreeIdentifier<T> getRootPath();
+    @NonNull DataTreeIdentifier<T> getRootPath();
 
     /**
      * Get the modification root node.
      *
      * @return modification root node
      */
-    @Nonnull DataObjectModification<T> getRootNode();
-
+    @NonNull DataObjectModification<T> getRootNode();
 }
index 09ab7693b7a25c30c98e81ca1396e2a93305c527..1250a9796e9413dbbf451e2b78274579d6abe946 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.binding.api;
 
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A data producer context. It allows transactions to be submitted to the subtrees specified at
@@ -34,14 +34,12 @@ import javax.annotation.Nonnull;
  *
  * <p>
  * When a producer is referenced in a call to
- * {@link DataTreeService#registerListener(DataTreeListener, java.util.Collection, boolean, java.util.Collection)}
- * , an attempt will be made to bind the producer to the specified {@link DataTreeListener}. Such an
- * attempt will fail the producer is already bound, or it has an open transaction. Once bound, the
- * producer can only be accessed from within the {@link DataTreeListener} callback on that
- * particular instance. Any transaction which is not submitted by the time the callback returns will
- * be implicitly cancelled. A producer becomes unbound when the listener it is bound to becomes
- * unregistered.
- *
+ * {@link DataTreeService#registerListener(DataTreeListener, java.util.Collection, boolean, java.util.Collection)},
+ * an attempt will be made to bind the producer to the specified {@link DataTreeListener}. Such an attempt will fail
+ * the producer is already bound, or it has an open transaction. Once bound, the producer can only be accessed
+ * from within the {@link DataTreeListener} callback on that particular instance. Any transaction which is not submitted
+ * by the time the callback returns will be implicitly cancelled. A producer becomes unbound when the listener it is
+ * bound to becomes unregistered.
  */
 public interface DataTreeProducer extends DataTreeProducerFactory, AutoCloseable {
     /**
@@ -59,8 +57,7 @@ public interface DataTreeProducer extends DataTreeProducerFactory, AutoCloseable
      *         exception is thrown on a best effort basis and programs should not rely on it for
      *         correct operation.
      */
-    @Nonnull
-    CursorAwareWriteTransaction createTransaction(boolean isolated);
+    @NonNull CursorAwareWriteTransaction createTransaction(boolean isolated);
 
     /**
      * {@inheritDoc}.
@@ -89,8 +86,7 @@ public interface DataTreeProducer extends DataTreeProducerFactory, AutoCloseable
      *         correct operation.
      */
     @Override
-    @Nonnull
-    DataTreeProducer createProducer(@Nonnull Collection<DataTreeIdentifier<?>> subtrees);
+    DataTreeProducer createProducer(Collection<DataTreeIdentifier<?>> subtrees);
 
     /**
      * {@inheritDoc}.
index 07edf8ad48e87fc4edf554c86aa9279a9a5e9378..1e06b4be915f99ac19f3a180c483c9ae43dc8800 100644 (file)
@@ -7,24 +7,22 @@
  */
 package org.opendaylight.mdsal.binding.api;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Exception indicating that the {@link DataTreeProducer} has an open user transaction and cannot be
  * closed.
  */
 public class DataTreeProducerBusyException extends DataTreeProducerException {
-
     private static final long serialVersionUID = 1L;
 
-
-    public DataTreeProducerBusyException(@Nonnull final String message, @Nonnull final Throwable cause) {
-        super(Preconditions.checkNotNull(message, "message"), cause);
+    public DataTreeProducerBusyException(final @NonNull String message, final @NonNull Throwable cause) {
+        super(requireNonNull(message, "message"), cause);
     }
 
-    public DataTreeProducerBusyException(@Nonnull final String message) {
-        super(Preconditions.checkNotNull(message, "message"));
+    public DataTreeProducerBusyException(final @NonNull String message) {
+        super(requireNonNull(message, "message"));
     }
-
 }
index 082bc74f792cde5c9baafd32de0c3dab13316c6e..3cd1876622488c3538cce568a9a9fd2c9b832ae6 100644 (file)
@@ -7,17 +7,16 @@
  */
 package org.opendaylight.mdsal.binding.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 public class DataTreeProducerException extends Exception {
-
     private static final long serialVersionUID = 1L;
 
-    public DataTreeProducerException(@Nonnull final String message, @Nonnull final Throwable cause) {
+    public DataTreeProducerException(final @NonNull String message, final @NonNull Throwable cause) {
         super(message, cause);
     }
 
-    public DataTreeProducerException(@Nonnull final String message) {
+    public DataTreeProducerException(final @NonNull String message) {
         super(message);
     }
 
index 7a51ba08251df46afd38b04f5fe0859de0e854ce..67b62d8c3d624ef0752d47017058866da043b086 100644 (file)
@@ -8,9 +8,9 @@
 package org.opendaylight.mdsal.binding.api;
 
 import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
 
 public interface DataTreeProducerFactory {
-
     /**
      * Create a producer, which is able to access to a set of trees.
      *
@@ -18,6 +18,5 @@ public interface DataTreeProducerFactory {
      * @return A {@link DataTreeProducer} instance.
      * @throws IllegalArgumentException if subtrees is empty.
      */
-    DataTreeProducer createProducer(Collection<DataTreeIdentifier<?>> subtrees);
-
+    @NonNull DataTreeProducer createProducer(@NonNull Collection<DataTreeIdentifier<?>> subtrees);
 }
\ No newline at end of file
index c2db154647d903587f304e338547fe093aa72963..abdec3a186c34382d2bbfd401782308a67318221 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.binding.api;
 
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
 /**
@@ -59,8 +59,7 @@ public interface DataTreeService extends DataTreeProducerFactory, BindingService
      * @throws DataTreeLoopException if the registration of the listener to the specified subtrees
      *         with specified producers would form a feedback loop
      */
-    @Nonnull
-    <T extends DataTreeListener> ListenerRegistration<T> registerListener(@Nonnull T listener,
-            @Nonnull Collection<DataTreeIdentifier<?>> subtrees, boolean allowRxMerges,
-            @Nonnull Collection<DataTreeProducer> producers) throws DataTreeLoopException;
+    <T extends DataTreeListener> @NonNull ListenerRegistration<T> registerListener(@NonNull T listener,
+            @NonNull Collection<DataTreeIdentifier<?>> subtrees, boolean allowRxMerges,
+            @NonNull Collection<DataTreeProducer> producers) throws DataTreeLoopException;
 }