Package org.xrpl.xrpl4j.model.ledger
Class ImmutableLedgerHeader.Builder
java.lang.Object
org.xrpl.xrpl4j.model.ledger.ImmutableLedgerHeader.Builder
- Enclosing class:
ImmutableLedgerHeader
Builds instances of type
ImmutableLedgerHeader.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionaccountHash(Optional<? extends Hash256> accountHash) Initializes the optional valueaccountHashto accountHash.accountHash(Hash256 accountHash) Initializes the optional valueaccountHashto accountHash.addAllTransactions(Iterable<? extends TransactionResult<? extends Transaction>> elements) Adds elements totransactionslist.addTransactions(TransactionResult<? extends Transaction> element) Adds one element totransactionslist.addTransactions(TransactionResult<? extends Transaction>... elements) Adds elements totransactionslist.build()Builds a newImmutableLedgerHeader.closed(boolean closed) Initializes the value for theclosedattribute.closeTime(com.google.common.primitives.UnsignedLong closeTime) Initializes the optional valuecloseTimeto closeTime.Initializes the optional valuecloseTimeto closeTime.closeTimeHuman(ZonedDateTime closeTimeHuman) Initializes the optional valuecloseTimeHumanto closeTimeHuman.closeTimeHuman(Optional<? extends ZonedDateTime> closeTimeHuman) Initializes the optional valuecloseTimeHumanto closeTimeHuman.closeTimeResolution(com.google.common.primitives.UnsignedInteger closeTimeResolution) Initializes the optional valuecloseTimeResolutionto closeTimeResolution.closeTimeResolution(Optional<? extends com.google.common.primitives.UnsignedInteger> closeTimeResolution) Initializes the optional valuecloseTimeResolutionto closeTimeResolution.from(LedgerHeader instance) Fill a builder with attribute values from the providedLedgerHeaderinstance.ledgerHash(Optional<? extends Hash256> ledgerHash) Initializes the optional valueledgerHashto ledgerHash.ledgerHash(Hash256 ledgerHash) Initializes the optional valueledgerHashto ledgerHash.ledgerIndex(LedgerIndex ledgerIndex) Initializes the value for theledgerIndexattribute.parentCloseTime(com.google.common.primitives.UnsignedLong parentCloseTime) Initializes the optional valueparentCloseTimeto parentCloseTime.parentCloseTime(Optional<? extends com.google.common.primitives.UnsignedLong> parentCloseTime) Initializes the optional valueparentCloseTimeto parentCloseTime.parentHash(Hash256 parentHash) Initializes the value for theparentHashattribute.totalCoins(Optional<? extends XrpCurrencyAmount> totalCoins) Initializes the optional valuetotalCoinsto totalCoins.totalCoins(XrpCurrencyAmount totalCoins) Initializes the optional valuetotalCoinsto totalCoins.transactionHash(Optional<? extends Hash256> transactionHash) Initializes the optional valuetransactionHashto transactionHash.transactionHash(Hash256 transactionHash) Initializes the optional valuetransactionHashto transactionHash.transactions(Iterable<? extends TransactionResult<? extends Transaction>> elements) Sets or replaces all elements fortransactionslist.
-
Method Details
-
from
Fill a builder with attribute values from the providedLedgerHeaderinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
ledgerIndex
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder ledgerIndex(LedgerIndex ledgerIndex) Initializes the value for theledgerIndexattribute.- Parameters:
ledgerIndex- The value for ledgerIndex- Returns:
thisbuilder for use in a chained invocation
-
ledgerHash
Initializes the optional valueledgerHashto ledgerHash.- Parameters:
ledgerHash- The value for ledgerHash- Returns:
thisbuilder for chained invocation
-
ledgerHash
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder ledgerHash(Optional<? extends Hash256> ledgerHash) Initializes the optional valueledgerHashto ledgerHash.- Parameters:
ledgerHash- The value for ledgerHash- Returns:
thisbuilder for use in a chained invocation
-
accountHash
Initializes the optional valueaccountHashto accountHash.- Parameters:
accountHash- The value for accountHash- Returns:
thisbuilder for chained invocation
-
accountHash
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder accountHash(Optional<? extends Hash256> accountHash) Initializes the optional valueaccountHashto accountHash.- Parameters:
accountHash- The value for accountHash- Returns:
thisbuilder for use in a chained invocation
-
closeTime
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder closeTime(com.google.common.primitives.UnsignedLong closeTime) Initializes the optional valuecloseTimeto closeTime.- Parameters:
closeTime- The value for closeTime- Returns:
thisbuilder for chained invocation
-
closeTime
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder closeTime(Optional<? extends com.google.common.primitives.UnsignedLong> closeTime) Initializes the optional valuecloseTimeto closeTime.- Parameters:
closeTime- The value for closeTime- Returns:
thisbuilder for use in a chained invocation
-
closeTimeHuman
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder closeTimeHuman(ZonedDateTime closeTimeHuman) Initializes the optional valuecloseTimeHumanto closeTimeHuman.- Parameters:
closeTimeHuman- The value for closeTimeHuman- Returns:
thisbuilder for chained invocation
-
closeTimeHuman
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder closeTimeHuman(Optional<? extends ZonedDateTime> closeTimeHuman) Initializes the optional valuecloseTimeHumanto closeTimeHuman.- Parameters:
closeTimeHuman- The value for closeTimeHuman- Returns:
thisbuilder for use in a chained invocation
-
closed
Initializes the value for theclosedattribute.If not set, this attribute will have a default value as returned by the initializer of
closed.- Parameters:
closed- The value for closed- Returns:
thisbuilder for use in a chained invocation
-
parentHash
Initializes the value for theparentHashattribute.- Parameters:
parentHash- The value for parentHash- Returns:
thisbuilder for use in a chained invocation
-
parentCloseTime
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder parentCloseTime(com.google.common.primitives.UnsignedLong parentCloseTime) Initializes the optional valueparentCloseTimeto parentCloseTime.- Parameters:
parentCloseTime- The value for parentCloseTime- Returns:
thisbuilder for chained invocation
-
parentCloseTime
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder parentCloseTime(Optional<? extends com.google.common.primitives.UnsignedLong> parentCloseTime) Initializes the optional valueparentCloseTimeto parentCloseTime.- Parameters:
parentCloseTime- The value for parentCloseTime- Returns:
thisbuilder for use in a chained invocation
-
totalCoins
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder totalCoins(XrpCurrencyAmount totalCoins) Initializes the optional valuetotalCoinsto totalCoins.- Parameters:
totalCoins- The value for totalCoins- Returns:
thisbuilder for chained invocation
-
totalCoins
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder totalCoins(Optional<? extends XrpCurrencyAmount> totalCoins) Initializes the optional valuetotalCoinsto totalCoins.- Parameters:
totalCoins- The value for totalCoins- Returns:
thisbuilder for use in a chained invocation
-
transactionHash
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder transactionHash(Hash256 transactionHash) Initializes the optional valuetransactionHashto transactionHash.- Parameters:
transactionHash- The value for transactionHash- Returns:
thisbuilder for chained invocation
-
transactionHash
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder transactionHash(Optional<? extends Hash256> transactionHash) Initializes the optional valuetransactionHashto transactionHash.- Parameters:
transactionHash- The value for transactionHash- Returns:
thisbuilder for use in a chained invocation
-
addTransactions
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder addTransactions(TransactionResult<? extends Transaction> element) Adds one element totransactionslist.- Parameters:
element- A transactions element- Returns:
thisbuilder for use in a chained invocation
-
addTransactions
@CanIgnoreReturnValue @SafeVarargs public final ImmutableLedgerHeader.Builder addTransactions(TransactionResult<? extends Transaction>... elements) Adds elements totransactionslist.- Parameters:
elements- An array of transactions elements- Returns:
thisbuilder for use in a chained invocation
-
transactions
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder transactions(Iterable<? extends TransactionResult<? extends Transaction>> elements) Sets or replaces all elements fortransactionslist.- Parameters:
elements- An iterable of transactions elements- Returns:
thisbuilder for use in a chained invocation
-
addAllTransactions
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder addAllTransactions(Iterable<? extends TransactionResult<? extends Transaction>> elements) Adds elements totransactionslist.- Parameters:
elements- An iterable of transactions elements- Returns:
thisbuilder for use in a chained invocation
-
closeTimeResolution
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder closeTimeResolution(com.google.common.primitives.UnsignedInteger closeTimeResolution) Initializes the optional valuecloseTimeResolutionto closeTimeResolution.- Parameters:
closeTimeResolution- The value for closeTimeResolution- Returns:
thisbuilder for chained invocation
-
closeTimeResolution
@CanIgnoreReturnValue public final ImmutableLedgerHeader.Builder closeTimeResolution(Optional<? extends com.google.common.primitives.UnsignedInteger> closeTimeResolution) Initializes the optional valuecloseTimeResolutionto closeTimeResolution.- Parameters:
closeTimeResolution- The value for closeTimeResolution- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableLedgerHeader.- Returns:
- An immutable instance of LedgerHeader
- Throws:
IllegalStateException- if any required attributes are missing
-