Package nxt
Class AccountLedger
- java.lang.Object
-
- nxt.AccountLedger
-
public class AccountLedger extends java.lang.Object
Maintain a ledger of changes to selected accounts
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AccountLedger.Event
Account ledger listener eventsstatic class
AccountLedger.LedgerEntry
Ledger entrystatic class
AccountLedger.LedgerEvent
Ledger events There must be a ledger event defined for each transaction (type,subtype) pair.static class
AccountLedger.LedgerHolding
Ledger holdings When adding a new holding, do not change the existing code assignments since they are stored in the holding_type field of the account_ledger table.
-
Field Summary
Fields Modifier and Type Field Description static int
trimKeep
Number of blocks to keep when trimming
-
Constructor Summary
Constructors Constructor Description AccountLedger()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
addListener(Listener<AccountLedger.LedgerEntry> listener, AccountLedger.Event eventType)
Add a listenerstatic java.util.List<AccountLedger.LedgerEntry>
getEntries(long accountId, AccountLedger.LedgerEvent event, long eventId, AccountLedger.LedgerHolding holding, long holdingId, int firstIndex, int lastIndex)
Return the ledger entries sorted in descending insert orderstatic AccountLedger.LedgerEntry
getEntry(long ledgerId)
Return a single entry identified by the ledger entry identifierstatic boolean
removeListener(Listener<AccountLedger.LedgerEntry> listener, AccountLedger.Event eventType)
Remove a listener
-
-
-
Method Detail
-
addListener
public static boolean addListener(Listener<AccountLedger.LedgerEntry> listener, AccountLedger.Event eventType)
Add a listener- Parameters:
listener
- ListenereventType
- Event to listen for- Returns:
- True if the listener was added
-
removeListener
public static boolean removeListener(Listener<AccountLedger.LedgerEntry> listener, AccountLedger.Event eventType)
Remove a listener- Parameters:
listener
- ListenereventType
- Event to listen for- Returns:
- True if the listener was removed
-
getEntry
public static AccountLedger.LedgerEntry getEntry(long ledgerId)
Return a single entry identified by the ledger entry identifier- Parameters:
ledgerId
- Ledger entry identifier- Returns:
- Ledger entry or null if entry not found
-
getEntries
public static java.util.List<AccountLedger.LedgerEntry> getEntries(long accountId, AccountLedger.LedgerEvent event, long eventId, AccountLedger.LedgerHolding holding, long holdingId, int firstIndex, int lastIndex)
Return the ledger entries sorted in descending insert order- Parameters:
accountId
- Account identifier or zero if no account identifierevent
- Ledger event or nulleventId
- Ledger event identifier or zero if no event identifierholding
- Ledger holding or nullholdingId
- Ledger holding identifier or zero if no holding identifierfirstIndex
- First matching entry index, inclusivelastIndex
- Last matching entry index, inclusive- Returns:
- List of ledger entries
-
-