Package org.xrpl.xrpl4j.model.ledger
Class ImmutableLedgerHeader
java.lang.Object
org.xrpl.xrpl4j.model.ledger.ImmutableLedgerHeader
- All Implemented Interfaces:
LedgerHeader
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableLedgerHeader
extends Object
implements LedgerHeader
Immutable implementation of
LedgerHeader.
Use the builder to create immutable instances:
ImmutableLedgerHeader.builder().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableLedgerHeader. -
Method Summary
Modifier and TypeMethodDescriptionThe SHA-512Half of this ledger's state tree information.builder()Creates a builder forImmutableLedgerHeader.booleanclosed()If true, this ledger version is no longer accepting new transactions.Optional<com.google.common.primitives.UnsignedLong> The approximate time this ledger version closed, as the number of seconds since the Ripple Epoch.The time this ledger was closed, in human-readable format.Optional<com.google.common.primitives.UnsignedInteger> AnUnsignedIntegerin the range [2,120] indicating the maximum number of seconds by which thecloseTime()could be rounded.static ImmutableLedgerHeadercopyOf(LedgerHeader instance) Creates an immutable copy of aLedgerHeadervalue.booleanThis instance is equal to all instances ofImmutableLedgerHeaderthat have equal attribute values.inthashCode()Computes a hash code from attributes:ledgerIndex,ledgerHash,accountHash,closeTime,closeTimeHuman,closed,parentHash,parentCloseTime,totalCoins,transactionHash,transactions,closeTimeResolution.The SHA-512Half of this ledger version.The ledger index of the ledger.Optional<com.google.common.primitives.UnsignedLong> The time at which the previous ledger was closed.TheledgerHash()value of the previous ledger version that is the direct predecessor of this one.toString()Prints the immutable valueLedgerHeaderwith attribute values.The total number of drops of XRP owned by accounts in the ledger.The SHA-512Half of the transactions included in this ledger.com.google.common.collect.ImmutableList<TransactionResult<? extends Transaction>> Transactions applied in this ledger version.final ImmutableLedgerHeaderwithAccountHash(Optional<? extends Hash256> optional) Copy the current immutable object by setting an optional value for theaccountHashattribute.final ImmutableLedgerHeaderwithAccountHash(Hash256 value) Copy the current immutable object by setting a present value for the optionalaccountHashattribute.final ImmutableLedgerHeaderwithClosed(boolean value) Copy the current immutable object by setting a value for theclosedattribute.final ImmutableLedgerHeaderwithCloseTime(com.google.common.primitives.UnsignedLong value) Copy the current immutable object by setting a present value for the optionalcloseTimeattribute.final ImmutableLedgerHeaderwithCloseTime(Optional<? extends com.google.common.primitives.UnsignedLong> optional) Copy the current immutable object by setting an optional value for thecloseTimeattribute.final ImmutableLedgerHeaderwithCloseTimeHuman(ZonedDateTime value) Copy the current immutable object by setting a present value for the optionalcloseTimeHumanattribute.final ImmutableLedgerHeaderwithCloseTimeHuman(Optional<? extends ZonedDateTime> optional) Copy the current immutable object by setting an optional value for thecloseTimeHumanattribute.final ImmutableLedgerHeaderwithCloseTimeResolution(com.google.common.primitives.UnsignedInteger value) Copy the current immutable object by setting a present value for the optionalcloseTimeResolutionattribute.final ImmutableLedgerHeaderwithCloseTimeResolution(Optional<? extends com.google.common.primitives.UnsignedInteger> optional) Copy the current immutable object by setting an optional value for thecloseTimeResolutionattribute.final ImmutableLedgerHeaderwithLedgerHash(Optional<? extends Hash256> optional) Copy the current immutable object by setting an optional value for theledgerHashattribute.final ImmutableLedgerHeaderwithLedgerHash(Hash256 value) Copy the current immutable object by setting a present value for the optionalledgerHashattribute.final ImmutableLedgerHeaderwithLedgerIndex(LedgerIndex value) Copy the current immutable object by setting a value for theledgerIndexattribute.final ImmutableLedgerHeaderwithParentCloseTime(com.google.common.primitives.UnsignedLong value) Copy the current immutable object by setting a present value for the optionalparentCloseTimeattribute.final ImmutableLedgerHeaderwithParentCloseTime(Optional<? extends com.google.common.primitives.UnsignedLong> optional) Copy the current immutable object by setting an optional value for theparentCloseTimeattribute.final ImmutableLedgerHeaderwithParentHash(Hash256 value) Copy the current immutable object by setting a value for theparentHashattribute.final ImmutableLedgerHeaderwithTotalCoins(Optional<? extends XrpCurrencyAmount> optional) Copy the current immutable object by setting an optional value for thetotalCoinsattribute.final ImmutableLedgerHeaderwithTotalCoins(XrpCurrencyAmount value) Copy the current immutable object by setting a present value for the optionaltotalCoinsattribute.final ImmutableLedgerHeaderwithTransactionHash(Optional<? extends Hash256> optional) Copy the current immutable object by setting an optional value for thetransactionHashattribute.final ImmutableLedgerHeaderwithTransactionHash(Hash256 value) Copy the current immutable object by setting a present value for the optionaltransactionHashattribute.final ImmutableLedgerHeaderwithTransactions(Iterable<? extends TransactionResult<? extends Transaction>> elements) Copy the current immutable object with elements that replace the content oftransactions.final ImmutableLedgerHeaderwithTransactions(TransactionResult<? extends Transaction>... elements) Copy the current immutable object with elements that replace the content oftransactions.
-
Method Details
-
ledgerIndex
The ledger index of the ledger. In other objects, this would be aLedgerIndex, however the ledger method returns the ledger_index as aStringrepresenting an unsigned 32 bit integer.- Specified by:
ledgerIndexin interfaceLedgerHeader- Returns:
- A
Stringcontaining the ledger index.
-
ledgerHash
The SHA-512Half of this ledger version. This serves as a unique identifier for this ledger and all its contents.- Specified by:
ledgerHashin interfaceLedgerHeader- Returns:
- An
Optionalof typeHash256containing the hash of the ledger.
-
accountHash
The SHA-512Half of this ledger's state tree information.- Specified by:
accountHashin interfaceLedgerHeader- Returns:
- An
Optionalof typeHash256containing the hash of this ledger's state tree.
-
closeTime
The approximate time this ledger version closed, as the number of seconds since the Ripple Epoch. This value is rounded based on thecloseTimeResolution()}.- Specified by:
closeTimein interfaceLedgerHeader- Returns:
- An
Optionalof typeUnsignedLongrepresenting the close time.
-
closeTimeHuman
The time this ledger was closed, in human-readable format. Always uses the UTC time zone.- Specified by:
closeTimeHumanin interfaceLedgerHeader- Returns:
- A
ZonedDateTimerepresenting thecloseTime()in human-readable format.
-
closed
public boolean closed()If true, this ledger version is no longer accepting new transactions. (However, unless this ledger version is validated, it might be replaced by a different ledger version with a different set of transactions.)- Specified by:
closedin interfaceLedgerHeader- Returns:
trueif this ledger version is no longer accepting new transactions, otherwisefalse.
-
parentHash
TheledgerHash()value of the previous ledger version that is the direct predecessor of this one. If there are different versions of the previous ledger index, this indicates from which one the ledger was derived.- Specified by:
parentHashin interfaceLedgerHeader- Returns:
- A
Hash256containing the hash of this ledger's parent ledger.
-
parentCloseTime
The time at which the previous ledger was closed.- Specified by:
parentCloseTimein interfaceLedgerHeader- Returns:
- An
UnsignedLongdenoting this ledger's parent ledger's close time.
-
totalCoins
The total number of drops of XRP owned by accounts in the ledger. This omits XRP that has been destroyed by transaction fees. The actual amount of XRP in circulation is lower because some accounts are "black holes" whose keys are not known by anyone.- Specified by:
totalCoinsin interfaceLedgerHeader- Returns:
- An
Optionalof typeXrpCurrencyAmountrepresenting the total number of coins.
-
transactionHash
The SHA-512Half of the transactions included in this ledger.- Specified by:
transactionHashin interfaceLedgerHeader- Returns:
- A
Hash256containing the hash of all transactions in this ledger.
-
transactions
public com.google.common.collect.ImmutableList<TransactionResult<? extends Transaction>> transactions()Transactions applied in this ledger version.- Specified by:
transactionsin interfaceLedgerHeader- Returns:
- A
ListofTransactionResults containing all the transactions in this ledger.
-
closeTimeResolution
AnUnsignedIntegerin the range [2,120] indicating the maximum number of seconds by which thecloseTime()could be rounded.- Specified by:
closeTimeResolutionin interfaceLedgerHeader- Returns:
- An
Optionalof typeUnsignedIntegerrepresenting the close time resolution.
-
withLedgerIndex
Copy the current immutable object by setting a value for theledgerIndexattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for ledgerIndex- Returns:
- A modified copy of the
thisobject
-
withLedgerHash
Copy the current immutable object by setting a present value for the optionalledgerHashattribute.- Parameters:
value- The value for ledgerHash- Returns:
- A modified copy of
thisobject
-
withLedgerHash
Copy the current immutable object by setting an optional value for theledgerHashattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for ledgerHash- Returns:
- A modified copy of
thisobject
-
withAccountHash
Copy the current immutable object by setting a present value for the optionalaccountHashattribute.- Parameters:
value- The value for accountHash- Returns:
- A modified copy of
thisobject
-
withAccountHash
Copy the current immutable object by setting an optional value for theaccountHashattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for accountHash- Returns:
- A modified copy of
thisobject
-
withCloseTime
Copy the current immutable object by setting a present value for the optionalcloseTimeattribute.- Parameters:
value- The value for closeTime- Returns:
- A modified copy of
thisobject
-
withCloseTime
public final ImmutableLedgerHeader withCloseTime(Optional<? extends com.google.common.primitives.UnsignedLong> optional) Copy the current immutable object by setting an optional value for thecloseTimeattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for closeTime- Returns:
- A modified copy of
thisobject
-
withCloseTimeHuman
Copy the current immutable object by setting a present value for the optionalcloseTimeHumanattribute.- Parameters:
value- The value for closeTimeHuman- Returns:
- A modified copy of
thisobject
-
withCloseTimeHuman
Copy the current immutable object by setting an optional value for thecloseTimeHumanattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for closeTimeHuman- Returns:
- A modified copy of
thisobject
-
withClosed
Copy the current immutable object by setting a value for theclosedattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for closed- Returns:
- A modified copy of the
thisobject
-
withParentHash
Copy the current immutable object by setting a value for theparentHashattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for parentHash- Returns:
- A modified copy of the
thisobject
-
withParentCloseTime
public final ImmutableLedgerHeader withParentCloseTime(com.google.common.primitives.UnsignedLong value) Copy the current immutable object by setting a present value for the optionalparentCloseTimeattribute.- Parameters:
value- The value for parentCloseTime- Returns:
- A modified copy of
thisobject
-
withParentCloseTime
public final ImmutableLedgerHeader withParentCloseTime(Optional<? extends com.google.common.primitives.UnsignedLong> optional) Copy the current immutable object by setting an optional value for theparentCloseTimeattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for parentCloseTime- Returns:
- A modified copy of
thisobject
-
withTotalCoins
Copy the current immutable object by setting a present value for the optionaltotalCoinsattribute.- Parameters:
value- The value for totalCoins- Returns:
- A modified copy of
thisobject
-
withTotalCoins
Copy the current immutable object by setting an optional value for thetotalCoinsattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for totalCoins- Returns:
- A modified copy of
thisobject
-
withTransactionHash
Copy the current immutable object by setting a present value for the optionaltransactionHashattribute.- Parameters:
value- The value for transactionHash- Returns:
- A modified copy of
thisobject
-
withTransactionHash
Copy the current immutable object by setting an optional value for thetransactionHashattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for transactionHash- Returns:
- A modified copy of
thisobject
-
withTransactions
@SafeVarargs public final ImmutableLedgerHeader withTransactions(TransactionResult<? extends Transaction>... elements) Copy the current immutable object with elements that replace the content oftransactions.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withTransactions
public final ImmutableLedgerHeader withTransactions(Iterable<? extends TransactionResult<? extends Transaction>> elements) Copy the current immutable object with elements that replace the content oftransactions. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of transactions elements to set- Returns:
- A modified copy of
thisobject
-
withCloseTimeResolution
public final ImmutableLedgerHeader withCloseTimeResolution(com.google.common.primitives.UnsignedInteger value) Copy the current immutable object by setting a present value for the optionalcloseTimeResolutionattribute.- Parameters:
value- The value for closeTimeResolution- Returns:
- A modified copy of
thisobject
-
withCloseTimeResolution
public final ImmutableLedgerHeader withCloseTimeResolution(Optional<? extends com.google.common.primitives.UnsignedInteger> optional) Copy the current immutable object by setting an optional value for thecloseTimeResolutionattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for closeTimeResolution- Returns:
- A modified copy of
thisobject
-
equals
This instance is equal to all instances ofImmutableLedgerHeaderthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:ledgerIndex,ledgerHash,accountHash,closeTime,closeTimeHuman,closed,parentHash,parentCloseTime,totalCoins,transactionHash,transactions,closeTimeResolution. -
toString
Prints the immutable valueLedgerHeaderwith attribute values. -
copyOf
Creates an immutable copy of aLedgerHeadervalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable LedgerHeader instance
-
builder
Creates a builder forImmutableLedgerHeader.ImmutableLedgerHeader.builder() .ledgerIndex(org.xrpl.xrpl4j.model.client.common.LedgerIndex) // requiredledgerIndex.ledgerHash(org.xrpl.xrpl4j.model.transactions.Hash256) // optionalledgerHash.accountHash(org.xrpl.xrpl4j.model.transactions.Hash256) // optionalaccountHash.closeTime(com.google.common.primitives.UnsignedLong) // optionalcloseTime.closeTimeHuman(java.time.ZonedDateTime) // optionalcloseTimeHuman.closed(boolean) // optionalclosed.parentHash(org.xrpl.xrpl4j.model.transactions.Hash256) // requiredparentHash.parentCloseTime(com.google.common.primitives.UnsignedLong) // optionalparentCloseTime.totalCoins(org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount) // optionaltotalCoins.transactionHash(org.xrpl.xrpl4j.model.transactions.Hash256) // optionaltransactionHash.addTransactions|addAllTransactions(org.xrpl.xrpl4j.model.client.transactions.TransactionResult<? extends org.xrpl.xrpl4j.model.transactions.Transaction>) //transactionselements .closeTimeResolution(com.google.common.primitives.UnsignedInteger) // optionalcloseTimeResolution.build();- Returns:
- A new ImmutableLedgerHeader builder
-