Add serialVersionUID fields
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / IncrementTransactionSequenceRequestProxyV1.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, 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.access.commands;
9
10 import akka.actor.ActorRef;
11 import java.io.IOException;
12 import java.io.ObjectInput;
13 import java.io.ObjectOutput;
14 import java.io.Serial;
15 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
16 import org.opendaylight.yangtools.concepts.WritableObjects;
17
18 final class IncrementTransactionSequenceRequestProxyV1
19         extends AbstractReadTransactionRequestProxyV1<IncrementTransactionSequenceRequest> {
20     @Serial
21     private static final long serialVersionUID = -7345885599575376005L;
22
23     private long increment;
24
25     // checkstyle flags the public modifier as redundant however it is explicitly needed for Java serialization to
26     // be able to create instances via reflection.
27     @SuppressWarnings("checkstyle:RedundantModifier")
28     public IncrementTransactionSequenceRequestProxyV1() {
29         // For Externalizable
30     }
31
32     IncrementTransactionSequenceRequestProxyV1(final IncrementTransactionSequenceRequest request) {
33         super(request);
34         increment = request.getIncrement();
35     }
36
37     @Override
38     public void writeExternal(final ObjectOutput out) throws IOException {
39         super.writeExternal(out);
40         WritableObjects.writeLong(out, increment);
41     }
42
43     @Override
44     public void readExternal(final ObjectInput in) throws ClassNotFoundException, IOException {
45         super.readExternal(in);
46         increment = WritableObjects.readLong(in);
47     }
48
49     @Override
50     IncrementTransactionSequenceRequest createReadRequest(final TransactionIdentifier target, final long sequence,
51             final ActorRef replyToActor, final boolean snapshotOnly) {
52         return new IncrementTransactionSequenceRequest(target, sequence, replyToActor, snapshotOnly, increment);
53     }
54 }