3110002e4fe91842c9f049f77466e7d900268d57
[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 java.io.Serial;
12 import org.opendaylight.controller.cluster.access.ABIVersion;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14
15 /**
16  * Successful reply to an {@link ExistsTransactionRequest}. It indicates presence of requested data via
17  * {@link #getExists()}.
18  */
19 public final class ExistsTransactionSuccess extends TransactionSuccess<ExistsTransactionSuccess> {
20     @Serial
21     private static final long serialVersionUID = 1L;
22
23     private final boolean exists;
24
25     public ExistsTransactionSuccess(final TransactionIdentifier target, final long sequence, final boolean exists) {
26         super(target, sequence);
27         this.exists = exists;
28     }
29
30     public boolean getExists() {
31         return exists;
32     }
33
34     @Override
35     protected ExistsTransactionSuccessProxyV1 externalizableProxy(final ABIVersion version) {
36         return new ExistsTransactionSuccessProxyV1(this);
37     }
38
39     @Override
40     protected ExistsTransactionSuccess cloneAsVersion(final ABIVersion version) {
41         return this;
42     }
43
44     @Override
45     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
46         return super.addToStringAttributes(toStringHelper).add("exists", exists);
47     }
48 }