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.token;
import com.hedera.hapi.node.base.*;
import com.hedera.hapi.node.token.*;
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 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 CryptoGetStakersQuery
*
* @param header (1) Standard response from node to client, including the requested fields: cost, or state proof,
* or both, or neither
* @param stakers (3) List of accounts proxy staking to this account, and the amount each is currently proxy
* staking
*/
public record CryptoGetStakersResponse(
@Nullable ResponseHeader header,
@Nullable AllProxyStakers stakers
) {
/** Protobuf codec for reading and writing in protobuf format */
public static final Codec PROTOBUF = new com.hedera.hapi.node.token.codec.CryptoGetStakersResponseProtoCodec();
/** JSON codec for reading and writing in JSON format */
public static final JsonCodec JSON = new com.hedera.hapi.node.token.codec.CryptoGetStakersResponseJsonCodec();
/** Default instance with all fields set to default values */
public static final CryptoGetStakersResponse DEFAULT = newBuilder().build();
/**
* Create a pre-populated CryptoGetStakersResponse.
*
* @param header (1) Standard response from node to client, including the requested fields: cost, or state proof,
* or both, or neither,
* @param stakers (3) List of accounts proxy staking to this account, and the amount each is currently proxy
* staking
*/
public CryptoGetStakersResponse(ResponseHeader header, AllProxyStakers stakers) {
this.header = header;
this.stakers = stakers;
}
/**
* 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 (stakers != null && !stakers.equals(DEFAULT.stakers)) {
result = 31 * result + stakers.hashCode();
}
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;
}
CryptoGetStakersResponse thatObj = (CryptoGetStakersResponse)that;
if (header == null && thatObj.header != null) {
return false;
}
if (header != null && !header.equals(thatObj.header)) {
return false;
}
if (stakers == null && thatObj.stakers != null) {
return false;
}
if (stakers != null && !stakers.equals(thatObj.stakers)) {
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 stakers has a value
*
* @return true of the stakers has a value
*/
public boolean hasStakers() {
return stakers != null;
}
/**
* Gets the value for stakers if it has a value, or else returns the default
* value for the type.
*
* @param defaultValue the default value to return if stakers is null
* @return the value for stakers if it has a value, or else returns the default value
*/
public AllProxyStakers stakersOrElse(@NonNull final AllProxyStakers defaultValue) {
return hasStakers() ? stakers : defaultValue;
}
/**
* Gets the value for stakers if it has a value, or else throws an NPE.
* value for the type.
*
* @return the value for stakers if it has a value
* @throws NullPointerException if stakers is null
*/
public @NonNull AllProxyStakers stakersOrThrow() {
return requireNonNull(stakers, "Field stakers is null");
}
/**
* Executes the supplied {@link Consumer} if, and only if, the stakers has a value
*
* @param ifPresent the {@link Consumer} to execute
*/
public void ifStakers(@NonNull final Consumer ifPresent) {
if (hasStakers()) {
ifPresent.accept(stakers);
}
}
/**
* 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, stakers);
}
/**
* 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 AllProxyStakers stakers = null;
/**
* 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 stakers (3) List of accounts proxy staking to this account, and the amount each is currently proxy
* staking
*/
public Builder(ResponseHeader header, AllProxyStakers stakers) {
this.header = header;
this.stakers = stakers;
}
/**
* Build a new model record with data set on builder
*
* @return new model record with data set
*/
public CryptoGetStakersResponse build() {
return new CryptoGetStakersResponse(header, stakers);
}
/**
* (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;
}
/**
* (3) List of accounts proxy staking to this account, and the amount each is currently proxy
* staking
*
* @param stakers value to set
* @return builder to continue building with
*/
public Builder stakers(@Nullable AllProxyStakers stakers) {
this.stakers = stakers;
return this;
}
/**
* (3) List of accounts proxy staking to this account, and the amount each is currently proxy
* staking
*
* @param builder A pre-populated builder
* @return builder to continue building with
*/
public Builder stakers(AllProxyStakers.Builder builder) {
this.stakers = builder.build() ;
return this;
}
}
}