X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-spi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2Fspi%2Fdata%2FAbstractDOMStoreTransaction.java;h=20166a46ad97f1fff356a62844833c6b3ddc0607;hb=refs%2Fchanges%2F11%2F80211%2F6;hp=f043d2cb84274f870ea8e05fec14ee3ce4069042;hpb=8edd92f999e5ff4588d284c3a1ae553549b84fb4;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/AbstractDOMStoreTransaction.java b/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/AbstractDOMStoreTransaction.java index f043d2cb84..20166a46ad 100644 --- a/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/AbstractDOMStoreTransaction.java +++ b/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/AbstractDOMStoreTransaction.java @@ -7,34 +7,37 @@ */ package org.opendaylight.controller.sal.core.spi.data; +import static java.util.Objects.requireNonNull; + import com.google.common.annotations.Beta; import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.common.base.Preconditions; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; /** * Abstract DOM Store Transaction. * + *

* Convenience super implementation of DOM Store transaction which provides * common implementation of {@link #toString()} and {@link #getIdentifier()}. * + *

* It can optionally capture the context where it was allocated. * - * identifier type + * @param identifier type */ @Beta public abstract class AbstractDOMStoreTransaction implements DOMStoreTransaction { private final Throwable debugContext; - private final T identifier; + private final @NonNull T identifier; - protected AbstractDOMStoreTransaction(@Nonnull final T identifier) { + protected AbstractDOMStoreTransaction(final @NonNull T identifier) { this(identifier, false); } - protected AbstractDOMStoreTransaction(@Nonnull final T identifier, final boolean debug) { - this.identifier = Preconditions.checkNotNull(identifier, "Identifier must not be null."); + protected AbstractDOMStoreTransaction(final @NonNull T identifier, final boolean debug) { + this.identifier = requireNonNull(identifier, "Identifier must not be null."); this.debugContext = debug ? new Throwable().fillInStackTrace() : null; } @@ -46,10 +49,9 @@ public abstract class AbstractDOMStoreTransaction implements DOMStoreTransact /** * Return the context in which this transaction was allocated. * - * @return The context in which this transaction was allocated, or null - * if the context was not recorded. + * @return The context in which this transaction was allocated, or null if the context was not recorded. */ - @Nullable public final Throwable getDebugContext() { + public final @Nullable Throwable getDebugContext() { return debugContext; } @@ -65,7 +67,7 @@ public abstract class AbstractDOMStoreTransaction implements DOMStoreTransact * ToStringHelper instance * @return ToStringHelper instance which was passed in */ - protected ToStringHelper addToStringAttributes(@Nonnull final ToStringHelper toStringHelper) { + protected ToStringHelper addToStringAttributes(final @NonNull ToStringHelper toStringHelper) { return toStringHelper.add("id", identifier); } }