Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.hedera.hapi.node.transaction;
import com.hedera.hapi.node.base.*;
import com.hedera.hapi.node.transaction.*;
import com.hedera.pbj.runtime.*;
import com.hedera.pbj.runtime.io.*;
import com.hedera.pbj.runtime.io.buffer.*;
import com.hedera.pbj.runtime.io.stream.*;
import edu.umd.cs.findbugs.annotations.*;
import java.util.*;
import com.hedera.pbj.runtime.Codec;
import java.util.function.Consumer;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.NonNull;
import static java.util.Objects.requireNonNull;
/**
* Response when the client sends the node TransactionGetReceiptQuery. If it created a new entity
* (account, file, or smart contract instance) then one of the three ID fields will be filled in
* with the ID of the new entity. Sometimes a single transaction will create more than one new
* entity, such as when a new contract instance is created, and this also creates the new account
* that it owned by that instance. No State proof is available for this response
*
* @param header (1) Standard response from node to client, including the requested fields: cost, or state proof,
* or both, or neither
* @param receipt (2) Either the receipt of processing the first consensus transaction with the given id whose
* status was neither INVALID_NODE_ACCOUNT nor INVALID_PAYER_SIGNATURE;
* or, if no such receipt exists, the receipt of processing the first transaction to
* reach consensus with the given transaction id.
* @param duplicateTransactionReceipts (4) The receipts of processing all transactions with the given id, in consensus time order.
* @param childTransactionReceipts (5) The receipts (if any) of all child transactions spawned by the transaction with the
* given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN.
*/
public record TransactionGetReceiptResponse(
@Nullable ResponseHeader header,
@Nullable TransactionReceipt receipt,
@NonNull List duplicateTransactionReceipts,
@NonNull List childTransactionReceipts
) {
/** Protobuf codec for reading and writing in protobuf format */
public static final Codec PROTOBUF = new com.hedera.hapi.node.transaction.codec.TransactionGetReceiptResponseProtoCodec();
/** JSON codec for reading and writing in JSON format */
public static final JsonCodec JSON = new com.hedera.hapi.node.transaction.codec.TransactionGetReceiptResponseJsonCodec();
/** Default instance with all fields set to default values */
public static final TransactionGetReceiptResponse DEFAULT = newBuilder().build();
/**
* Create a pre-populated TransactionGetReceiptResponse.
*
* @param header (1) Standard response from node to client, including the requested fields: cost, or state proof,
* or both, or neither,
* @param receipt (2) Either the receipt of processing the first consensus transaction with the given id whose
* status was neither INVALID_NODE_ACCOUNT nor INVALID_PAYER_SIGNATURE;
* or, if no such receipt exists, the receipt of processing the first transaction to
* reach consensus with the given transaction id.,
* @param duplicateTransactionReceipts (4) The receipts of processing all transactions with the given id, in consensus time order.,
* @param childTransactionReceipts (5) The receipts (if any) of all child transactions spawned by the transaction with the
* given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN.
*/
public TransactionGetReceiptResponse(ResponseHeader header, TransactionReceipt receipt, List duplicateTransactionReceipts, List childTransactionReceipts) {
this.header = header;
this.receipt = receipt;
this.duplicateTransactionReceipts = duplicateTransactionReceipts == null ? Collections.emptyList() : duplicateTransactionReceipts;
this.childTransactionReceipts = childTransactionReceipts == null ? Collections.emptyList() : childTransactionReceipts;
}
/**
* Override the default hashCode method for
* all other objects to make hashCode
*/
@Override
public int hashCode() {
int result = 1;
if (header != null && !header.equals(DEFAULT.header)) {
result = 31 * result + header.hashCode();
}
if (receipt != null && !receipt.equals(DEFAULT.receipt)) {
result = 31 * result + receipt.hashCode();
}
java.util.List list$duplicateTransactionReceipts = duplicateTransactionReceipts;
if (list$duplicateTransactionReceipts != null) {
for (Object o : list$duplicateTransactionReceipts) {
if (o != null) {
result = 31 * result + o.hashCode();
} else {
result = 31 * result;
}
}
}
java.util.List list$childTransactionReceipts = childTransactionReceipts;
if (list$childTransactionReceipts != null) {
for (Object o : list$childTransactionReceipts) {
if (o != null) {
result = 31 * result + o.hashCode();
} else {
result = 31 * result;
}
}
}
long hashCode = result;
// Shifts: 30, 27, 16, 20, 5, 18, 10, 24, 30
hashCode += hashCode << 30;
hashCode ^= hashCode >>> 27;
hashCode += hashCode << 16;
hashCode ^= hashCode >>> 20;
hashCode += hashCode << 5;
hashCode ^= hashCode >>> 18;
hashCode += hashCode << 10;
hashCode ^= hashCode >>> 24;
hashCode += hashCode << 30;
return (int)hashCode;
}
/**
* Override the default equals method for
*/
@Override
public boolean equals(Object that) {
if (that == null || this.getClass() != that.getClass()) {
return false;
}
TransactionGetReceiptResponse thatObj = (TransactionGetReceiptResponse)that;
if (header == null && thatObj.header != null) {
return false;
}
if (header != null && !header.equals(thatObj.header)) {
return false;
}
if (receipt == null && thatObj.receipt != null) {
return false;
}
if (receipt != null && !receipt.equals(thatObj.receipt)) {
return false;
}
if (this.duplicateTransactionReceipts == null && thatObj.duplicateTransactionReceipts != null) {
return false;
}
if (this.duplicateTransactionReceipts != null && !duplicateTransactionReceipts.equals(thatObj.duplicateTransactionReceipts)) {
return false;
}
if (this.childTransactionReceipts == null && thatObj.childTransactionReceipts != null) {
return false;
}
if (this.childTransactionReceipts != null && !childTransactionReceipts.equals(thatObj.childTransactionReceipts)) {
return false;
}
return true;
}
/**
* Convenience method to check if the header has a value
*
* @return true of the header has a value
*/
public boolean hasHeader() {
return header != null;
}
/**
* Gets the value for header if it has a value, or else returns the default
* value for the type.
*
* @param defaultValue the default value to return if header is null
* @return the value for header if it has a value, or else returns the default value
*/
public ResponseHeader headerOrElse(@NonNull final ResponseHeader defaultValue) {
return hasHeader() ? header : defaultValue;
}
/**
* Gets the value for header if it has a value, or else throws an NPE.
* value for the type.
*
* @return the value for header if it has a value
* @throws NullPointerException if header is null
*/
public @NonNull ResponseHeader headerOrThrow() {
return requireNonNull(header, "Field header is null");
}
/**
* Executes the supplied {@link Consumer} if, and only if, the header has a value
*
* @param ifPresent the {@link Consumer} to execute
*/
public void ifHeader(@NonNull final Consumer ifPresent) {
if (hasHeader()) {
ifPresent.accept(header);
}
}
/**
* Convenience method to check if the receipt has a value
*
* @return true of the receipt has a value
*/
public boolean hasReceipt() {
return receipt != null;
}
/**
* Gets the value for receipt if it has a value, or else returns the default
* value for the type.
*
* @param defaultValue the default value to return if receipt is null
* @return the value for receipt if it has a value, or else returns the default value
*/
public TransactionReceipt receiptOrElse(@NonNull final TransactionReceipt defaultValue) {
return hasReceipt() ? receipt : defaultValue;
}
/**
* Gets the value for receipt if it has a value, or else throws an NPE.
* value for the type.
*
* @return the value for receipt if it has a value
* @throws NullPointerException if receipt is null
*/
public @NonNull TransactionReceipt receiptOrThrow() {
return requireNonNull(receipt, "Field receipt is null");
}
/**
* Executes the supplied {@link Consumer} if, and only if, the receipt has a value
*
* @param ifPresent the {@link Consumer} to execute
*/
public void ifReceipt(@NonNull final Consumer ifPresent) {
if (hasReceipt()) {
ifPresent.accept(receipt);
}
}
/**
* Return a builder for building a copy of this model object. It will be pre-populated with all the data from this
* model object.
*
* @return a pre-populated builder
*/
public Builder copyBuilder() {
return new Builder(header, receipt, duplicateTransactionReceipts, childTransactionReceipts);
}
/**
* Return a new builder for building a model object. This is just a shortcut for new Model.Builder().
*
* @return a new builder
*/
public static Builder newBuilder() {
return new Builder();
}
/**
* Builder class for easy creation, ideal for clean code where performance is not critical. In critical performance
* paths use the constructor directly.
*/
public static final class Builder {
@Nullable private ResponseHeader header = null;
@Nullable private TransactionReceipt receipt = null;
@NonNull private List duplicateTransactionReceipts = Collections.emptyList();
@NonNull private List childTransactionReceipts = Collections.emptyList();
/**
* Create an empty builder
*/
public Builder() {}
/**
* Create a pre-populated Builder.
*
* @param header (1) Standard response from node to client, including the requested fields: cost, or state proof,
* or both, or neither,
* @param receipt (2) Either the receipt of processing the first consensus transaction with the given id whose
* status was neither INVALID_NODE_ACCOUNT nor INVALID_PAYER_SIGNATURE;
* or, if no such receipt exists, the receipt of processing the first transaction to
* reach consensus with the given transaction id.,
* @param duplicateTransactionReceipts (4) The receipts of processing all transactions with the given id, in consensus time order.,
* @param childTransactionReceipts (5) The receipts (if any) of all child transactions spawned by the transaction with the
* given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN.
*/
public Builder(ResponseHeader header, TransactionReceipt receipt, List duplicateTransactionReceipts, List childTransactionReceipts) {
this.header = header;
this.receipt = receipt;
this.duplicateTransactionReceipts = duplicateTransactionReceipts == null ? Collections.emptyList() : duplicateTransactionReceipts;
this.childTransactionReceipts = childTransactionReceipts == null ? Collections.emptyList() : childTransactionReceipts;
}
/**
* Build a new model record with data set on builder
*
* @return new model record with data set
*/
public TransactionGetReceiptResponse build() {
return new TransactionGetReceiptResponse(header, receipt, duplicateTransactionReceipts, childTransactionReceipts);
}
/**
* (1) Standard response from node to client, including the requested fields: cost, or state proof,
* or both, or neither
*
* @param header value to set
* @return builder to continue building with
*/
public Builder header(@Nullable ResponseHeader header) {
this.header = header;
return this;
}
/**
* (1) Standard response from node to client, including the requested fields: cost, or state proof,
* or both, or neither
*
* @param builder A pre-populated builder
* @return builder to continue building with
*/
public Builder header(ResponseHeader.Builder builder) {
this.header = builder.build() ;
return this;
}
/**
* (2) Either the receipt of processing the first consensus transaction with the given id whose
* status was neither INVALID_NODE_ACCOUNT nor INVALID_PAYER_SIGNATURE;
* or, if no such receipt exists, the receipt of processing the first transaction to
* reach consensus with the given transaction id.
*
* @param receipt value to set
* @return builder to continue building with
*/
public Builder receipt(@Nullable TransactionReceipt receipt) {
this.receipt = receipt;
return this;
}
/**
* (2) Either the receipt of processing the first consensus transaction with the given id whose
* status was neither INVALID_NODE_ACCOUNT nor INVALID_PAYER_SIGNATURE;
* or, if no such receipt exists, the receipt of processing the first transaction to
* reach consensus with the given transaction id.
*
* @param builder A pre-populated builder
* @return builder to continue building with
*/
public Builder receipt(TransactionReceipt.Builder builder) {
this.receipt = builder.build() ;
return this;
}
/**
* (4) The receipts of processing all transactions with the given id, in consensus time order.
*
* @param duplicateTransactionReceipts value to set
* @return builder to continue building with
*/
public Builder duplicateTransactionReceipts(@NonNull List duplicateTransactionReceipts) {
this.duplicateTransactionReceipts = duplicateTransactionReceipts != null ? duplicateTransactionReceipts : Collections.emptyList();
return this;
}
/**
* (4) The receipts of processing all transactions with the given id, in consensus time order.
*
* @param values varargs value to be built into a list
* @return builder to continue building with
*/
public Builder duplicateTransactionReceipts(TransactionReceipt ... values) {
this.duplicateTransactionReceipts = values == null ? Collections.emptyList() : List.of(values) ;
return this;
}
/**
* (5) The receipts (if any) of all child transactions spawned by the transaction with the
* given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN.
*
* @param childTransactionReceipts value to set
* @return builder to continue building with
*/
public Builder childTransactionReceipts(@NonNull List childTransactionReceipts) {
this.childTransactionReceipts = childTransactionReceipts != null ? childTransactionReceipts : Collections.emptyList();
return this;
}
/**
* (5) The receipts (if any) of all child transactions spawned by the transaction with the
* given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN.
*
* @param values varargs value to be built into a list
* @return builder to continue building with
*/
public Builder childTransactionReceipts(TransactionReceipt ... values) {
this.childTransactionReceipts = values == null ? Collections.emptyList() : List.of(values) ;
return this;
}
}
}