Package com.tuladb

Record Class Models.AccountKey

java.lang.Object
java.lang.Record
com.tuladb.Models.AccountKey
Enclosing class:
Models

public static record Models.AccountKey(int ledgerId, int currency, long idHi, long idLo) extends Record
An account's identity on wire version 3: (ledgerId, currency, id).

One business id holds one balance per currency, and the ledger is the tenant boundary, so every account-addressed call names all three. A key that names no account answers ERR_NOT_FOUND, never another key's account. Encoded as WireAccountKey {u32 ledger_id; u32 currency; u64 reserved = 0; u128 id} (32 bytes). Keyed calls take this type, never a bare id. ledgerId and currency are u32 on the wire (Java int, read unsigned).

  • Constructor Summary

    Constructors
    Constructor
    Description
    AccountKey(int ledgerId, int currency, long idHi, long idLo)
    Creates an instance of a AccountKey record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the currency record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the idHi record component.
    long
    Returns the value of the idLo record component.
    int
    Returns the value of the ledgerId record component.
    of(int ledgerId, int currency, long idLo)
    Key for an id that fits in 64 bits (unsigned).
    The key of the account a creates.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AccountKey

      public AccountKey(int ledgerId, int currency, long idHi, long idLo)
      Creates an instance of a AccountKey record class.
      Parameters:
      ledgerId - the value for the ledgerId record component
      currency - the value for the currency record component
      idHi - the value for the idHi record component
      idLo - the value for the idLo record component
  • Method Details

    • of

      public static Models.AccountKey of(int ledgerId, int currency, long idLo)
      Key for an id that fits in 64 bits (unsigned).
    • of

      The key of the account a creates.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • ledgerId

      public int ledgerId()
      Returns the value of the ledgerId record component.
      Returns:
      the value of the ledgerId record component
    • currency

      public int currency()
      Returns the value of the currency record component.
      Returns:
      the value of the currency record component
    • idHi

      public long idHi()
      Returns the value of the idHi record component.
      Returns:
      the value of the idHi record component
    • idLo

      public long idLo()
      Returns the value of the idLo record component.
      Returns:
      the value of the idLo record component