f816002c9a3cd42f52e92eb2e21a1383776b8941
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / persisted / SS.java
1 /*
2  * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.datastore.persisted;
9
10 import static com.google.common.base.Verify.verifyNotNull;
11 import static java.util.Objects.requireNonNull;
12
13 /**
14  * Serialization proxy for {@link ShardSnapshotState}.
15  */
16 final class SS implements ShardSnapshotState.SerialForm {
17     @java.io.Serial
18     private static final long serialVersionUID = 1L;
19
20     private ShardSnapshotState snapshotState;
21
22     @SuppressWarnings("checkstyle:RedundantModifier")
23     public SS() {
24         // For Externalizable
25     }
26
27     SS(final ShardSnapshotState snapshotState) {
28         this.snapshotState = requireNonNull(snapshotState);
29     }
30
31     @Override
32     public ShardSnapshotState snapshotState() {
33         return snapshotState;
34     }
35
36     @Override
37     public void resolveTo(final ShardSnapshotState newSnapshotState) {
38         snapshotState = requireNonNull(newSnapshotState);
39     }
40
41     @Override
42     public Object readResolve() {
43         return verifyNotNull(snapshotState);
44     }
45 }