/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
*/
package org.opendaylight.controller.cluster.access.concepts;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import java.io.Serial;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
* A request message concept. Upon receipt of this message, the recipient will respond with either
* a {@link RequestSuccess} or a {@link RequestFailure} message.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
* @param <C> Message type
*/
-@Beta
public abstract class Request<T extends WritableIdentifier, C extends Request<T, C>> extends Message<T, C> {
+ @Serial
private static final long serialVersionUID = 1L;
- private final ActorRef replyTo;
- protected Request(@Nonnull final T target, final long sequence, @Nonnull final ActorRef replyTo) {
+ private final @NonNull ActorRef replyTo;
+
+ protected Request(final @NonNull T target, final long sequence, final @NonNull ActorRef replyTo) {
super(target, sequence);
- this.replyTo = Preconditions.checkNotNull(replyTo);
+ this.replyTo = requireNonNull(replyTo);
}
- protected Request(@Nonnull final C request, @Nonnull final ABIVersion version) {
+ protected Request(final @NonNull C request, final @NonNull ABIVersion version) {
super(request, version);
- this.replyTo = Preconditions.checkNotNull(request.getReplyTo());
+ this.replyTo = requireNonNull(request.getReplyTo());
}
/**
*
* @return Original requestor
*/
- @Nonnull
- public final ActorRef getReplyTo() {
+ public final @NonNull ActorRef getReplyTo() {
return replyTo;
}
* @param cause Failure cause
* @return {@link RequestFailure} corresponding to this request
*/
- @Nonnull
- public abstract RequestFailure<T, ?> toRequestFailure(@Nonnull final RequestException cause);
+ public abstract @NonNull RequestFailure<T, ?> toRequestFailure(@NonNull RequestException cause);
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
}
@Override
- protected abstract AbstractRequestProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+ protected abstract AbstractRequestProxy<T, C> externalizableProxy(ABIVersion version);
}