Interface LedgerSpecifier
- All Known Implementing Classes:
ImmutableLedgerSpecifier
@Immutable
public interface LedgerSpecifier
Represents one of the three ways of specifying a ledger in a rippled API request.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LedgerSpecifierRequest information about the most recent ledger that has been closed for modifications and proposed for validation.static final LedgerSpecifierRequest information about for the most recent ledger that has been validated by consensus.static final LedgerSpecifierRequest information about a rippled server's current working version of the ledger. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidhandle(Consumer<Hash256> ledgerHashHandler, Consumer<LedgerIndex> ledgerIndexHandler, Consumer<LedgerIndexShortcut> ledgerIndexShortcutHandler) Handle thisLedgerSpecifierdepending on which specifier is present.A 20-byte hex string for the ledger version to use.The ledger index of the ledger to use.A shortcut word specifying the ledger to use.default <R> Rmap(Function<Hash256, R> ledgerHashMapper, Function<LedgerIndex, R> ledgerIndexMapper, Function<LedgerIndexShortcut, R> ledgerIndexShortcutMapper) Map thisLedgerSpecifierto an instance ofLedgerSpecifier, depending on which specifier is present.static LedgerSpecifierof(int ledgerIndex) Construct aLedgerSpecifierwith a numerical ledger index.static LedgerSpecifierof(com.google.common.primitives.UnsignedInteger ledgerIndex) Construct aLedgerSpecifierwith a numerical ledger index.static LedgerSpecifierof(LedgerIndex ledgerIndex) Construct aLedgerSpecifierwith a numerical ledger index.static LedgerSpecifierConstruct aLedgerSpecifierwith a ledger hash.default voidValidates that only one of the three fields in aLedgerSpecifieris present.
-
Field Details
-
VALIDATED
Request information about a rippled server's current working version of the ledger. -
CURRENT
Request information about for the most recent ledger that has been validated by consensus. -
CLOSED
Request information about the most recent ledger that has been closed for modifications and proposed for validation.
-
-
Method Details
-
of
Construct aLedgerSpecifierwith a ledger hash.- Parameters:
ledgerHash- AHash256containing the ledger hash of the desired ledger.- Returns:
- A
LedgerSpecifiercontainingledgerHash.
-
of
Construct aLedgerSpecifierwith a numerical ledger index.- Parameters:
ledgerIndex- TheLedgerIndexof the desired ledger.- Returns:
- A
LedgerSpecifiercontainingledgerIndex.
-
of
Construct aLedgerSpecifierwith a numerical ledger index.- Parameters:
ledgerIndex- TheUnsignedIntegerof the desired ledger.- Returns:
- A
LedgerSpecifiercontainingledgerIndex.
-
of
Construct aLedgerSpecifierwith a numerical ledger index.- Parameters:
ledgerIndex- Theintof the desired ledger.- Returns:
- A
LedgerSpecifiercontainingledgerIndex.
-
ledgerHash
A 20-byte hex string for the ledger version to use.- Returns:
- An optionally-present
Hash256.
-
ledgerIndex
Optional<LedgerIndex> ledgerIndex()The ledger index of the ledger to use.- Returns:
- An optionally-present
LedgerIndex.
-
ledgerIndexShortcut
Optional<LedgerIndexShortcut> ledgerIndexShortcut()A shortcut word specifying the ledger to use.- Returns:
- An optionally-present
LedgerIndexShortcut.
-
handle
@Auxiliary default void handle(Consumer<Hash256> ledgerHashHandler, Consumer<LedgerIndex> ledgerIndexHandler, Consumer<LedgerIndexShortcut> ledgerIndexShortcutHandler) Handle thisLedgerSpecifierdepending on which specifier is present.- Parameters:
ledgerHashHandler- AConsumerthat is called ifledgerHash()is present.ledgerIndexHandler- AConsumerthat is called ifledgerIndex()is present.ledgerIndexShortcutHandler- AConsumerthat is called ifledgerIndexShortcut()is present.
-
map
@Auxiliary default <R> R map(Function<Hash256, R> ledgerHashMapper, Function<LedgerIndex, R> ledgerIndexMapper, Function<LedgerIndexShortcut, R> ledgerIndexShortcutMapper) Map thisLedgerSpecifierto an instance ofLedgerSpecifier, depending on which specifier is present.- Type Parameters:
R- The type of object to return after mapping.- Parameters:
ledgerHashMapper- AFunctionthat is called ifledgerHash()is present.ledgerIndexMapper- AFunctionthat is called ifledgerIndex()is present.ledgerIndexShortcutMapper- AFunctionthat is called ifledgerIndexShortcut()is present.- Returns:
- A
LedgerSpecifierthat is constructed by the appropriate mapper function.
-
validateOnlyOneSpecified
@Check default void validateOnlyOneSpecified()Validates that only one of the three fields in aLedgerSpecifieris present.
-