From 494252860011b0ab46ed1d1ad7511f100ca255b9 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 8 Oct 2018 12:35:44 +0200 Subject: [PATCH] Migrate mdsal-binding-api to JDT annotations 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 --- binding/mdsal-binding-api/pom.xml | 9 +++++ .../api/CursorAwareWriteTransaction.java | 6 +--- .../binding/api/DataObjectModification.java | 34 +++++++++---------- .../binding/api/DataTreeChangeListener.java | 4 +-- .../binding/api/DataTreeChangeService.java | 6 ++-- .../binding/api/DataTreeCommitCohort.java | 10 ++---- .../mdsal/binding/api/DataTreeCursor.java | 14 ++++---- .../binding/api/DataTreeCursorProvider.java | 9 ++--- .../mdsal/binding/api/DataTreeIdentifier.java | 8 ++--- .../mdsal/binding/api/DataTreeListener.java | 9 +++-- .../api/DataTreeListeningException.java | 21 ++++++------ .../binding/api/DataTreeLoopException.java | 11 +++--- .../binding/api/DataTreeModification.java | 14 +++----- .../mdsal/binding/api/DataTreeProducer.java | 22 +++++------- .../api/DataTreeProducerBusyException.java | 16 ++++----- .../api/DataTreeProducerException.java | 7 ++-- .../binding/api/DataTreeProducerFactory.java | 5 ++- .../mdsal/binding/api/DataTreeService.java | 9 +++-- 18 files changed, 95 insertions(+), 119 deletions(-) diff --git a/binding/mdsal-binding-api/pom.xml b/binding/mdsal-binding-api/pom.xml index a2c1a2d286..a96333092f 100644 --- a/binding/mdsal-binding-api/pom.xml +++ b/binding/mdsal-binding-api/pom.xml @@ -93,6 +93,15 @@ + + org.apache.felix + maven-bundle-plugin + + + !javax.annotation,* + + + org.apache.maven.plugins maven-checkstyle-plugin diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/CursorAwareWriteTransaction.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/CursorAwareWriteTransaction.java index 7c024a864b..46d5c5d427 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/CursorAwareWriteTransaction.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/CursorAwareWriteTransaction.java @@ -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 - DataTreeWriteCursor createCursor(@Nonnull DataTreeIdentifier path); + DataTreeWriteCursor createCursor(DataTreeIdentifier path); /** * Cancels the transaction. diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataObjectModification.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataObjectModification.java index fc4bb4ee4a..1236bc8cde 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataObjectModification.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataObjectModification.java @@ -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 extends * * @return type of modified object. */ - @Nonnull Class getDataType(); + @NonNull Class 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 extends * * @return unmodifiable collection of modified direct children. */ - @Nonnull Collection> getModifiedChildren(); + @NonNull Collection> getModifiedChildren(); /** * Returns child list item modification if {@code child} was modified by this modification. @@ -95,7 +94,7 @@ public interface DataObjectModification extends * to generated model. */ > Collection> getModifiedChildren( - @Nonnull Class childType); + @NonNull Class 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 extends * to generated model. */ & DataObject, C extends ChildOf> Collection> - getModifiedChildren(@Nonnull Class caseType, @Nonnull Class childType); + getModifiedChildren(@NonNull Class caseType, @NonNull Class childType); /** * Returns container child modification if {@code child} was modified by this modification. This method should be @@ -123,8 +122,8 @@ public interface DataObjectModification extends * @throws IllegalArgumentException If supplied {@code child} class is not valid child according * to generated model. */ - @Nullable & DataObject, C extends ChildOf> DataObjectModification - getModifiedChildContainer(@Nonnull Class caseType, @Nonnull Class child); + & DataObject, C extends ChildOf> @Nullable DataObjectModification + getModifiedChildContainer(@NonNull Class caseType, @NonNull Class child); /** * Returns container child modification if {@code child} was modified by this @@ -138,8 +137,8 @@ public interface DataObjectModification extends * @throws IllegalArgumentException If supplied {@code child} class is not valid child according * to generated model. */ - @Nullable > DataObjectModification getModifiedChildContainer( - @Nonnull Class child); + > @Nullable DataObjectModification getModifiedChildContainer( + @NonNull Class child); /** * Returns augmentation child modification if {@code augmentation} was modified by this modification. @@ -152,8 +151,8 @@ public interface DataObjectModification extends * @throws IllegalArgumentException If supplied {@code augmentation} class is not valid augmentation * according to generated model. */ - @Nullable & DataObject> DataObjectModification getModifiedAugmentation( - @Nonnull Class augmentation); + & DataObject> @Nullable DataObjectModification getModifiedAugmentation( + @NonNull Class augmentation); /** * Returns child list item modification if {@code child} was modified by this modification. @@ -165,7 +164,7 @@ public interface DataObjectModification extends * to generated model. */ & ChildOf, K extends Identifier> DataObjectModification - getModifiedChildListItem(@Nonnull Class listItem, @Nonnull K listKey); + getModifiedChildListItem(@NonNull Class listItem, @NonNull K listKey); /** * Returns child list item modification if {@code child} was modified by this modification. @@ -177,8 +176,8 @@ public interface DataObjectModification extends * to generated model. */ & DataObject, C extends Identifiable & ChildOf, - K extends Identifier> DataObjectModification getModifiedChildListItem(@Nonnull Class caseType, - @Nonnull Class listItem, @Nonnull K listKey); + K extends Identifier> @Nullable DataObjectModification getModifiedChildListItem( + @NonNull Class caseType, @NonNull Class 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 extends * generated model. */ @Nullable DataObjectModification getModifiedChild(PathArgument childArgument); - } 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..b6ae850e36 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; /** @@ -40,5 +40,5 @@ 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); } diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeService.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeService.java index aae09b4886..6558ec8b27 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeService.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeChangeService.java @@ -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 > ListenerRegistration - registerDataTreeChangeListener(@Nonnull DataTreeIdentifier treeId, @Nonnull L listener); + > @NonNull ListenerRegistration + registerDataTreeChangeListener(@NonNull DataTreeIdentifier treeId, @NonNull L listener); } \ No newline at end of file diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCommitCohort.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCommitCohort.java index f72c11b9b2..abc8aa84b8 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCommitCohort.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCommitCohort.java @@ -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 <ttkacik@cisco.com> - * */ @Beta public interface DataTreeCommitCohort { - /** * Validates the supplied data tree modifications and associates the cohort-specific steps with data broker * transaction. @@ -103,7 +100,6 @@ public interface DataTreeCommitCohort { * more specific subclasses of this exception to provide additional information about * validation failure reason. */ - FluentFuture canCommit(@Nonnull Object txId, - @Nonnull Collection> modifications); - + FluentFuture canCommit(@NonNull Object txId, + @NonNull Collection> modifications); } diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursor.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursor.java index 84895acba5..1560216b0e 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursor.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursor.java @@ -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 path); + void enter(@NonNull Iterable path); /** * Move the cursor up to the parent of current position. This is equivalent of invoking diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursorProvider.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursorProvider.java index 003afcf578..f00bf495a2 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursorProvider.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeCursorProvider.java @@ -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 - DataTreeCursor createCursor(@Nonnull DataTreeIdentifier path); + @Nullable DataTreeCursor createCursor(@NonNull DataTreeIdentifier path); } diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeIdentifier.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeIdentifier.java index 5193465864..c8eaaad3c1 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeIdentifier.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeIdentifier.java @@ -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 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 implements Immutable * * @return Instance identifier corresponding to the root node. */ - @Nonnull - public InstanceIdentifier getRootIdentifier() { + public @NonNull InstanceIdentifier getRootIdentifier() { return rootIdentifier; } diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListener.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListener.java index cabcec92f4..b432ea2708 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListener.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListener.java @@ -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> changes, - @Nonnull Map, DataObject> subtrees); + void onDataTreeChanged(@NonNull Collection> changes, + @NonNull Map, 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 causes); - + void onDataTreeFailed(@NonNull Collection causes); } \ No newline at end of file diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListeningException.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListeningException.java index 2a05c62c91..4f67838ba4 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListeningException.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeListeningException.java @@ -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 diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeLoopException.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeLoopException.java index 326349d576..cfa86c7191 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeLoopException.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeLoopException.java @@ -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); } diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeModification.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeModification.java index 2899ef6cb2..3b85bf55b5 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeModification.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeModification.java @@ -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 <ttkacik@cisco.com> - * */ public interface DataTreeModification { - /** - * 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 getRootPath(); + @NonNull DataTreeIdentifier getRootPath(); /** * Get the modification root node. * * @return modification root node */ - @Nonnull DataObjectModification getRootNode(); - + @NonNull DataObjectModification getRootNode(); } diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducer.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducer.java index 09ab7693b7..1250a9796e 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducer.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducer.java @@ -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; * *

* 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> subtrees); + DataTreeProducer createProducer(Collection> subtrees); /** * {@inheritDoc}. diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerBusyException.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerBusyException.java index 07edf8ad48..1e06b4be91 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerBusyException.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerBusyException.java @@ -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")); } - } diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerException.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerException.java index 082bc74f79..3cd1876622 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerException.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerException.java @@ -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); } diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerFactory.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerFactory.java index 7a51ba0825..67b62d8c3d 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerFactory.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeProducerFactory.java @@ -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> subtrees); - + @NonNull DataTreeProducer createProducer(@NonNull Collection> subtrees); } \ No newline at end of file diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeService.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeService.java index c2db154647..abdec3a186 100644 --- a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeService.java +++ b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataTreeService.java @@ -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 - ListenerRegistration registerListener(@Nonnull T listener, - @Nonnull Collection> subtrees, boolean allowRxMerges, - @Nonnull Collection producers) throws DataTreeLoopException; + @NonNull ListenerRegistration registerListener(@NonNull T listener, + @NonNull Collection> subtrees, boolean allowRxMerges, + @NonNull Collection producers) throws DataTreeLoopException; } -- 2.36.6