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 com.google.common.base.Preconditions;
11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import javax.annotation.Nonnull;
15 * Reply to GetSnapshot that returns a serialized Snapshot instance.
17 * @author Thomas Pantelis
19 public class GetSnapshotReply {
20 private final String id;
21 private final byte[] snapshot;
23 public GetSnapshotReply(@Nonnull String id, @Nonnull byte[] snapshot) {
24 this.id = Preconditions.checkNotNull(id);
25 this.snapshot = Preconditions.checkNotNull(snapshot);
29 public String getId() {
33 @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Exposes a mutable object stored in a field but "
34 + "this is OK since this class is merely a DTO and does not process the byte[] internally. "
35 + "Also it would be inefficient to create a return copy as the byte[] could be large.")
37 public byte[] getSnapshot() {
42 public String toString() {
43 return "GetSnapshotReply [id=" + id + ", snapshot.length=" + snapshot.length + "]";