Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / ExistsTransactionSuccess.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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 com.google.common.base.MoreObjects.ToStringHelper;
11 import org.opendaylight.controller.cluster.access.ABIVersion;
12 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
13
14 /**
15  * Successful reply to an {@link ExistsTransactionRequest}. It indicates presence of requested data via
16  * {@link #getExists()}.
17  */
18 public final class ExistsTransactionSuccess extends TransactionSuccess<ExistsTransactionSuccess> {
19     @java.io.Serial
20     private static final long serialVersionUID = 1L;
21
22     private final boolean exists;
23
24     private ExistsTransactionSuccess(final ExistsTransactionSuccess success, final ABIVersion version) {
25         super(success, version);
26         exists = success.exists;
27     }
28
29     public ExistsTransactionSuccess(final TransactionIdentifier target, final long sequence, final boolean exists) {
30         super(target, sequence);
31         this.exists = exists;
32     }
33
34     public boolean getExists() {
35         return exists;
36     }
37
38     @Override
39     protected ETS externalizableProxy(final ABIVersion version) {
40         return new ETS(this);
41     }
42
43     @Override
44     protected ExistsTransactionSuccess cloneAsVersion(final ABIVersion version) {
45         return new ExistsTransactionSuccess(this, version);
46     }
47
48     @Override
49     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
50         return super.addToStringAttributes(toStringHelper).add("exists", exists);
51     }
52 }