2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.raft.client.messages;
10 import static java.util.Objects.requireNonNull;
12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
17 * Reply to GetSnapshot that returns a serialized Snapshot instance.
19 * @author Thomas Pantelis
21 public class GetSnapshotReply {
22 private final String id;
23 private final Snapshot snapshot;
25 public GetSnapshotReply(@NonNull String id, @NonNull Snapshot snapshot) {
26 this.id = requireNonNull(id);
27 this.snapshot = requireNonNull(snapshot);
30 public @NonNull String getId() {
34 @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Exposes a mutable object stored in a field but "
35 + "this is OK since this class is merely a DTO and does not process the byte[] internally. "
36 + "Also it would be inefficient to create a return copy as the byte[] could be large.")
37 public @NonNull Snapshot getSnapshot() {
42 public String toString() {
43 return "GetSnapshotReply [id=" + id + ", snapshot=" + snapshot + "]";