Migrate entity ownership to JDT annotations 44/76744/10
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Oct 2018 11:53:28 +0000 (13:53 +0200)
committerJie Han <han.jie@zte.com.cn>
Tue, 9 Oct 2018 06:44:43 +0000 (06:44 +0000)
This removes the use of javax.annotation nullable annotations
to remove import-package.

Change-Id: If89fd8302e1e709c23c6802e3e10341f96bcfe00
JIRA: MDSAL-373
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 files changed:
entityownership/mdsal-eos-binding-adapter/src/main/java/org/opendaylight/mdsal/eos/binding/dom/adapter/BindingDOMEntityOwnershipServiceAdapter.java
entityownership/mdsal-eos-binding-api/src/main/java/org/opendaylight/mdsal/eos/binding/api/Entity.java
entityownership/mdsal-eos-binding-api/src/main/java/org/opendaylight/mdsal/eos/binding/api/EntityOwnershipChange.java
entityownership/mdsal-eos-binding-api/src/main/java/org/opendaylight/mdsal/eos/binding/api/EntityOwnershipService.java
entityownership/mdsal-eos-common-api/src/main/java/org/opendaylight/mdsal/eos/common/api/CandidateAlreadyRegisteredException.java
entityownership/mdsal-eos-common-api/src/main/java/org/opendaylight/mdsal/eos/common/api/GenericEntity.java
entityownership/mdsal-eos-common-api/src/main/java/org/opendaylight/mdsal/eos/common/api/GenericEntityOwnershipChange.java
entityownership/mdsal-eos-common-api/src/main/java/org/opendaylight/mdsal/eos/common/api/GenericEntityOwnershipListenerRegistration.java
entityownership/mdsal-eos-common-api/src/main/java/org/opendaylight/mdsal/eos/common/api/GenericEntityOwnershipService.java
entityownership/mdsal-eos-common-api/src/test/java/org/opendaylight/mdsal/eos/common/api/GenericEntityTest.java
entityownership/mdsal-eos-common-spi/src/main/java/org/opendaylight/mdsal/eos/common/spi/AbstractGenericEntityOwnershipCandidateRegistration.java
entityownership/mdsal-eos-common-spi/src/main/java/org/opendaylight/mdsal/eos/common/spi/AbstractGenericEntityOwnershipListenerRegistration.java
entityownership/mdsal-eos-dom-api/src/main/java/org/opendaylight/mdsal/eos/dom/api/DOMEntity.java
entityownership/mdsal-eos-dom-api/src/main/java/org/opendaylight/mdsal/eos/dom/api/DOMEntityOwnershipChange.java
entityownership/mdsal-eos-dom-api/src/main/java/org/opendaylight/mdsal/eos/dom/api/DOMEntityOwnershipService.java

index 6fd10707e94198c0cd3b4d65e42c992a1a79aea7..97cdb69718e8690624454d26a90d1f2e745f1ba3 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.mdsal.eos.binding.dom.adapter;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.mdsal.eos.binding.api.Entity;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipCandidateRegistration;
@@ -31,39 +32,40 @@ import org.slf4j.LoggerFactory;
 public class BindingDOMEntityOwnershipServiceAdapter implements EntityOwnershipService, AutoCloseable {
     static final Logger LOG = LoggerFactory.getLogger(BindingDOMEntityOwnershipServiceAdapter.class);
 
-    private final DOMEntityOwnershipService domService;
-    private final BindingNormalizedNodeSerializer conversionCodec;
+    private final @NonNull DOMEntityOwnershipService domService;
+    private final @NonNull BindingNormalizedNodeSerializer conversionCodec;
 
-    public BindingDOMEntityOwnershipServiceAdapter(@Nonnull DOMEntityOwnershipService domService,
-            @Nonnull BindingNormalizedNodeSerializer conversionCodec) {
-        this.domService = Preconditions.checkNotNull(domService);
-        this.conversionCodec = Preconditions.checkNotNull(conversionCodec);
+    public BindingDOMEntityOwnershipServiceAdapter(final @NonNull DOMEntityOwnershipService domService,
+            @NonNull final BindingNormalizedNodeSerializer conversionCodec) {
+        this.domService = requireNonNull(domService);
+        this.conversionCodec = requireNonNull(conversionCodec);
     }
 
     @Override
-    public EntityOwnershipCandidateRegistration registerCandidate(Entity entity)
+    public EntityOwnershipCandidateRegistration registerCandidate(final Entity entity)
             throws CandidateAlreadyRegisteredException {
         return new BindingEntityOwnershipCandidateRegistration(
                 domService.registerCandidate(toDOMEntity(entity)), entity);
     }
 
     @Override
-    public EntityOwnershipListenerRegistration registerListener(String entityType, EntityOwnershipListener listener) {
-        return new BindingEntityOwnershipListenerRegistration(entityType, listener, domService
-                .registerListener(entityType, new DOMEntityOwnershipListenerAdapter(listener, conversionCodec)));
+    public EntityOwnershipListenerRegistration registerListener(final String entityType,
+            final EntityOwnershipListener listener) {
+        return new BindingEntityOwnershipListenerRegistration(entityType, listener,
+            domService.registerListener(entityType, new DOMEntityOwnershipListenerAdapter(listener, conversionCodec)));
     }
 
     @Override
-    public Optional<EntityOwnershipState> getOwnershipState(Entity forEntity) {
+    public Optional<EntityOwnershipState> getOwnershipState(final Entity forEntity) {
         return domService.getOwnershipState(toDOMEntity(forEntity));
     }
 
     @Override
-    public boolean isCandidateRegistered(Entity forEntity) {
+    public boolean isCandidateRegistered(final Entity forEntity) {
         return domService.isCandidateRegistered(toDOMEntity(forEntity));
     }
 
-    private DOMEntity toDOMEntity(Entity entity) {
+    private @NonNull DOMEntity toDOMEntity(final Entity entity) {
         return new DOMEntity(entity.getType(), conversionCodec.toYangInstanceIdentifier(entity.getIdentifier()));
     }
 
index 7f5e024bea3ab1f15d102b427f285d58971424c9..3b1cee14d70d424d1c1866428ff1ba0c4f4d95cd 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.mdsal.eos.binding.api;
 
 import com.google.common.annotations.Beta;
 import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.eos.common.api.GenericEntity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.core.general.entity.rev150930.EntityKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -28,7 +28,7 @@ public class Entity extends GenericEntity<InstanceIdentifier<?>> {
      * @param type the entity type
      * @param id the entity id.
      */
-    public Entity(@Nonnull final String type, @Nonnull final InstanceIdentifier<?> id) {
+    public Entity(final @NonNull String type, final @NonNull InstanceIdentifier<?> id) {
         super(type, id);
     }
 
@@ -39,7 +39,7 @@ public class Entity extends GenericEntity<InstanceIdentifier<?>> {
      * @param type the type of the entity
      * @param entityName the name of the entity used to construct a general-entity InstanceIdentifier
      */
-    public Entity(@Nonnull String type, @Nonnull String entityName) {
+    public Entity(final @NonNull String type, final @NonNull String entityName) {
         super(type, InstanceIdentifier.builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                 .mdsal.core.general.entity.rev150930.Entity.class,
                     new EntityKey(Preconditions.checkNotNull(entityName, "entityName should not be null"))).build());
index 6bf801f4456502065ddb47b0782e83a309c74abe..a1ea425da83708310eb20d50b00eff455600ddeb 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.eos.binding.api;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipChangeState;
 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipChange;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -21,11 +21,11 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 @Beta
 public class EntityOwnershipChange extends GenericEntityOwnershipChange<InstanceIdentifier<?>, Entity> {
 
-    public EntityOwnershipChange(@Nonnull final Entity entity, @Nonnull final EntityOwnershipChangeState state) {
+    public EntityOwnershipChange(final @NonNull Entity entity, final @NonNull EntityOwnershipChangeState state) {
         super(entity, state, false);
     }
 
-    public EntityOwnershipChange(@Nonnull final Entity entity, @Nonnull final EntityOwnershipChangeState state,
+    public EntityOwnershipChange(final @NonNull Entity entity, final @NonNull EntityOwnershipChangeState state,
             final boolean inJeopardy) {
         super(entity, state, inJeopardy);
     }
index f2532d230d42c01ea41cd40d0db1e312c96e4e0c..a32cb6e101c353841f39d278275f66004cca4e20 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.mdsal.eos.binding.api;
 
 import com.google.common.annotations.Beta;
 import java.util.Optional;
-import javax.annotation.Nonnull;
 import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException;
 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipState;
 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipService;
@@ -25,16 +24,16 @@ public interface EntityOwnershipService extends
         GenericEntityOwnershipService<InstanceIdentifier<?>, Entity, EntityOwnershipListener> {
 
     @Override
-    EntityOwnershipCandidateRegistration registerCandidate(@Nonnull Entity entity)
+    EntityOwnershipCandidateRegistration registerCandidate(Entity entity)
             throws CandidateAlreadyRegisteredException;
 
     @Override
-    EntityOwnershipListenerRegistration registerListener(@Nonnull String entityType,
-            @Nonnull EntityOwnershipListener listener);
+    EntityOwnershipListenerRegistration registerListener(String entityType,
+            EntityOwnershipListener listener);
 
     @Override
-    Optional<EntityOwnershipState> getOwnershipState(@Nonnull Entity forEntity);
+    Optional<EntityOwnershipState> getOwnershipState(Entity forEntity);
 
     @Override
-    boolean isCandidateRegistered(@Nonnull Entity forEntity);
+    boolean isCandidateRegistered(Entity forEntity);
 }
index 8f1871c8d057d65950100afd24204123a1de5e38..07f8eaf5ad5db5f14e6df1d3a970b7de875af722 100644 (file)
@@ -5,11 +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.eos.common.api;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Path;
 
 /**
@@ -19,12 +19,11 @@ import org.opendaylight.yangtools.concepts.Path;
 public class CandidateAlreadyRegisteredException extends Exception {
     private static final long serialVersionUID = 1L;
 
-    private final GenericEntity<?> entity;
+    private final @NonNull GenericEntity<?> entity;
 
-    public <T extends Path<T>> CandidateAlreadyRegisteredException(@Nonnull GenericEntity<T> entity) {
-        super(String.format("Candidate has already been registered for %s",
-                Preconditions.checkNotNull(entity, "entity should not be null")));
-        this.entity = entity;
+    public <T extends Path<T>> CandidateAlreadyRegisteredException(@NonNull final GenericEntity<T> entity) {
+        super("Candidate has already been registered for " + entity);
+        this.entity = requireNonNull(entity, "entity should not be null");
     }
 
     /**
@@ -35,8 +34,7 @@ public class CandidateAlreadyRegisteredException extends Exception {
      * @return the entity.
      */
     @SuppressWarnings("unchecked")
-    @Nonnull
-    public <T extends Path<T>> GenericEntity<T> getEntity() {
+    public <T extends Path<T>> @NonNull GenericEntity<T> getEntity() {
         return (GenericEntity<T>) entity;
     }
 }
index 90c7fd6293bbb16ae884fc7d6b05dac6d82b9a76..2e7a0bec9d1fa3f5d3435feece67b61be748e7ef 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.mdsal.eos.common.api;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.Path;
 
@@ -43,21 +44,20 @@ import org.opendaylight.yangtools.concepts.Path;
 public class GenericEntity<T extends Path<T>> implements Serializable, Identifiable<T> {
     private static final long serialVersionUID = 1L;
 
-    private final String type;
-    private final T id;
+    private final @NonNull String type;
+    private final @NonNull T id;
 
-    protected GenericEntity(@Nonnull String type, @Nonnull T id) {
-        this.type = Preconditions.checkNotNull(type, "type should not be null");
-        this.id = Preconditions.checkNotNull(id, "id should not be null");
+    protected GenericEntity(@NonNull final String type, @NonNull final T id) {
+        this.type = requireNonNull(type, "type should not be null");
+        this.id = requireNonNull(id, "id should not be null");
     }
 
     /**
      * Gets the id of the entity.
      * @return the id.
      */
-    @Nonnull
     @Override
-    public final T getIdentifier() {
+    public final @NonNull T getIdentifier() {
         return id;
     }
 
@@ -65,14 +65,13 @@ public class GenericEntity<T extends Path<T>> implements Serializable, Identifia
      * Gets the type of the entity.
      * @return the type.
      */
-    @Nonnull
-    public final String getType() {
+    public final @NonNull String getType() {
         return type;
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
index 5e0a499979b6c8ccbabe461f7b3dc9dba2b60cea..16e3566aec6e09f9aa88c50f9da1f53ceb997751 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.mdsal.eos.common.api;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Path;
 
 /**
@@ -20,18 +21,18 @@ import org.opendaylight.yangtools.concepts.Path;
  * @param <E> the GenericEntity type
  */
 public class GenericEntityOwnershipChange<P extends Path<P>, E extends GenericEntity<P>> {
-    private final E entity;
-    private final EntityOwnershipChangeState state;
+    private final @NonNull E entity;
+    private final @NonNull EntityOwnershipChangeState state;
     private final boolean inJeopardy;
 
-    public GenericEntityOwnershipChange(@Nonnull final E entity, @Nonnull final EntityOwnershipChangeState state) {
+    public GenericEntityOwnershipChange(final @NonNull E entity, final @NonNull EntityOwnershipChangeState state) {
         this(entity, state, false);
     }
 
-    public GenericEntityOwnershipChange(@Nonnull final E entity, @Nonnull final EntityOwnershipChangeState state,
+    public GenericEntityOwnershipChange(final @NonNull E entity, final @NonNull EntityOwnershipChangeState state,
             final boolean inJeopardy) {
-        this.entity = Preconditions.checkNotNull(entity, "entity can't be null");
-        this.state = Preconditions.checkNotNull(state, "state can't be null");
+        this.entity = requireNonNull(entity, "entity can't be null");
+        this.state = requireNonNull(state, "state can't be null");
         this.inJeopardy = inJeopardy;
     }
 
@@ -39,7 +40,7 @@ public class GenericEntityOwnershipChange<P extends Path<P>, E extends GenericEn
      * Returns the entity whose ownership status changed.
      * @return the entity
      */
-    @Nonnull public E getEntity() {
+    public @NonNull E getEntity() {
         return entity;
     }
 
@@ -47,7 +48,7 @@ public class GenericEntityOwnershipChange<P extends Path<P>, E extends GenericEn
      * Returns the ownership change state.
      * @return an EntityOwnershipChangeState enum
      */
-    @Nonnull public EntityOwnershipChangeState getState() {
+    public @NonNull EntityOwnershipChangeState getState() {
         return state;
     }
 
index 06427facac406253b528a4b58f8a4fe6c271df9f..9bcdd0cd7f230df02eb15a54fb813ec04943ef08 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.mdsal.eos.common.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.concepts.Path;
 
@@ -30,7 +30,7 @@ public interface GenericEntityOwnershipListenerRegistration<P extends Path<P>,
      *
      * @return the entity type that the listener was registered for
      */
-    @Nonnull String getEntityType();
+    @NonNull String getEntityType();
 
     /**
      * Unregister the listener.
index e7be6767214a4e0c70f9efda82554be9ebd5a3be..e73d26acb322335dbc42479422f666f0edebf6d9 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.eos.common.api;
 
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Path;
 
 /**
@@ -43,7 +43,7 @@ public interface GenericEntityOwnershipService<P extends Path<P>, E extends Gene
      * @return a registration object that can be used to unregister the Candidate
      * @throws CandidateAlreadyRegisteredException if the candidate was already registered
      */
-    GenericEntityOwnershipCandidateRegistration<P, E> registerCandidate(@Nonnull E entity)
+    GenericEntityOwnershipCandidateRegistration<P, E> registerCandidate(@NonNull E entity)
             throws CandidateAlreadyRegisteredException;
 
     /**
@@ -56,7 +56,7 @@ public interface GenericEntityOwnershipService<P extends Path<P>, E extends Gene
      * @param listener the listener that is interested in the entities
      * @return a registration object that can be used to unregister the Listener
      */
-    GenericEntityOwnershipListenerRegistration<P, L> registerListener(@Nonnull String entityType, @Nonnull L listener);
+    GenericEntityOwnershipListenerRegistration<P, L> registerListener(@NonNull String entityType, @NonNull L listener);
 
     /**
      * Gets the current ownership state information for an entity.
@@ -64,7 +64,7 @@ public interface GenericEntityOwnershipService<P extends Path<P>, E extends Gene
      * @param forEntity the entity to query.
      * @return an Optional EntityOwnershipState whose instance is present if the entity is found
      */
-    Optional<EntityOwnershipState> getOwnershipState(@Nonnull E forEntity);
+    Optional<EntityOwnershipState> getOwnershipState(@NonNull E forEntity);
 
     /**
      * Checks if a local candidate is registered for the given entity.
@@ -72,5 +72,5 @@ public interface GenericEntityOwnershipService<P extends Path<P>, E extends Gene
      * @param forEntity the entity to query.
      * @return true if a candidate is registered locally, false otherwise
      */
-    boolean isCandidateRegistered(@Nonnull E forEntity);
+    boolean isCandidateRegistered(@NonNull E forEntity);
 }
index 46ac72f9e2c8a4db806145811d08151b224b60e9..6f78ddc7f6e6bcbd8cc758105aac96e98c22e2a0 100644 (file)
@@ -12,7 +12,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
-import javax.annotation.Nonnull;
 import org.junit.Test;
 import org.opendaylight.yangtools.concepts.Path;
 
@@ -37,14 +36,14 @@ public class GenericEntityTest {
 
     private final class TestClass implements Path {
         @Override
-        public boolean contains(@Nonnull Path other) {
+        public boolean contains(final Path other) {
             return false;
         }
     }
 
     private final class TestClassDiff implements Path {
         @Override
-        public boolean contains(@Nonnull Path other) {
+        public boolean contains(final Path other) {
             return false;
         }
     }
index 7bfd4f235fc7d2af4d0cbf1c0842ef7b6b054215..eb19fdf8fc07bd08c621ee1f079273325fddcba6 100644 (file)
@@ -5,11 +5,9 @@
  * 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.eos.common.spi;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.eos.common.api.GenericEntity;
 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipCandidateRegistration;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
@@ -22,11 +20,9 @@ import org.opendaylight.yangtools.concepts.Path;
  * @param <E> the GenericEntity type
  */
 public abstract class AbstractGenericEntityOwnershipCandidateRegistration<P extends Path<P>, E extends GenericEntity<P>>
-        extends AbstractObjectRegistration<E>
-        implements GenericEntityOwnershipCandidateRegistration<P, E> {
+        extends AbstractObjectRegistration<E> implements GenericEntityOwnershipCandidateRegistration<P, E> {
 
-    protected AbstractGenericEntityOwnershipCandidateRegistration(@Nonnull final E entity) {
-        super(Preconditions.checkNotNull(entity, "entity cannot be null"));
+    protected AbstractGenericEntityOwnershipCandidateRegistration(final @NonNull E entity) {
+        super(entity);
     }
 }
-
index 60ad35c8313611b46de8c83bb282011da4461cd9..5a588894b7140855ef5de5988736a78c5a16c413 100644 (file)
@@ -5,11 +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.eos.common.spi;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.eos.common.api.GenericEntity;
 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipChange;
 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipListener;
@@ -28,12 +28,12 @@ public abstract class AbstractGenericEntityOwnershipListenerRegistration<P exten
         extends AbstractObjectRegistration<L>
         implements GenericEntityOwnershipListenerRegistration<P, L> {
 
-    private final String entityType;
+    private final @NonNull String entityType;
 
-    protected AbstractGenericEntityOwnershipListenerRegistration(@Nonnull final L instance,
-            @Nonnull final String entityType) {
+    protected AbstractGenericEntityOwnershipListenerRegistration(@NonNull final L instance,
+            @NonNull final String entityType) {
         super(instance);
-        this.entityType = Preconditions.checkNotNull(entityType, "entityType cannot be null");
+        this.entityType = requireNonNull(entityType, "entityType cannot be null");
     }
 
     @Override
index 63b8352200b0b6de2fb974b02f439e5eacb5028c..feac6315b10ed5bef9139acf4ab6a64fd87437c3 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.mdsal.eos.dom.api;
 
 import com.google.common.annotations.Beta;
 import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.eos.common.api.GenericEntity;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -27,13 +27,12 @@ public class DOMEntity extends GenericEntity<YangInstanceIdentifier> {
             "urn:opendaylight:params:xml:ns:yang:mdsal:core:general-entity", "2015-09-30", "entity").intern();
     static final QName ENTITY_NAME = QName.create(ENTITY, "name").intern();
 
-
     /** Constructs an instance.
      *
      * @param type the entity type
      * @param id the entity id.
      */
-    public DOMEntity(@Nonnull final String type, @Nonnull final YangInstanceIdentifier id) {
+    public DOMEntity(final @NonNull String type, final @NonNull YangInstanceIdentifier id) {
         super(type, id);
     }
 
@@ -44,7 +43,7 @@ public class DOMEntity extends GenericEntity<YangInstanceIdentifier> {
      * @param type the type of the entity
      * @param entityName the name of the entity used to construct a general-entity YangInstanceIdentifier
      */
-    public DOMEntity(@Nonnull String type, @Nonnull String entityName) {
+    public DOMEntity(final @NonNull String type, final @NonNull String entityName) {
         super(type, YangInstanceIdentifier.builder().node(ENTITY).nodeWithKey(ENTITY, ENTITY_NAME,
                 Preconditions.checkNotNull(entityName, "entityName should not be null")).build());
     }
index aa32716f7b6ade7bbd681c97ba594589b49a28d5..8a3483d3b381cdeba9673d01e6934f0a16a52990 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.eos.dom.api;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipChangeState;
 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipChange;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -20,14 +20,11 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
  */
 @Beta
 public class DOMEntityOwnershipChange extends GenericEntityOwnershipChange<YangInstanceIdentifier, DOMEntity> {
-
-
-    public DOMEntityOwnershipChange(@Nonnull final DOMEntity entity, @Nonnull final EntityOwnershipChangeState state) {
+    public DOMEntityOwnershipChange(final @NonNull DOMEntity entity, final @NonNull EntityOwnershipChangeState state) {
         super(entity, state, false);
     }
 
-
-    public DOMEntityOwnershipChange(@Nonnull final DOMEntity entity, @Nonnull final EntityOwnershipChangeState state,
+    public DOMEntityOwnershipChange(final @NonNull DOMEntity entity, final @NonNull EntityOwnershipChangeState state,
             final boolean inJeopardy) {
         super(entity, state, inJeopardy);
     }
index 3acf2659c344245efdd6217033af0b2df70411fc..b844475745c8b916c4aeee6831c105b277680df5 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.mdsal.eos.dom.api;
 
 import com.google.common.annotations.Beta;
 import java.util.Optional;
-import javax.annotation.Nonnull;
 import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException;
 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipState;
 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipService;
@@ -23,22 +22,17 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 @Beta
 public interface DOMEntityOwnershipService extends
         GenericEntityOwnershipService<YangInstanceIdentifier, DOMEntity, DOMEntityOwnershipListener> {
-
-
     @Override
-    DOMEntityOwnershipCandidateRegistration registerCandidate(@Nonnull DOMEntity entity)
+    DOMEntityOwnershipCandidateRegistration registerCandidate(DOMEntity entity)
             throws CandidateAlreadyRegisteredException;
 
-
     @Override
-    DOMEntityOwnershipListenerRegistration registerListener(@Nonnull String entityType,
-            @Nonnull DOMEntityOwnershipListener listener);
-
+    DOMEntityOwnershipListenerRegistration registerListener(String entityType,
+            DOMEntityOwnershipListener listener);
 
     @Override
-    Optional<EntityOwnershipState> getOwnershipState(@Nonnull DOMEntity forEntity);
-
+    Optional<EntityOwnershipState> getOwnershipState(DOMEntity forEntity);
 
     @Override
-    boolean isCandidateRegistered(@Nonnull DOMEntity forEntity);
+    boolean isCandidateRegistered(DOMEntity forEntity);
 }