Record Class TxRecord

java.lang.Object
java.lang.Record
com.patelheet.capitalengine.api.TxRecord
Record Components:
txId - ledger sequence number
time - commit time
type - dotted type, for example market.trade
memo - plain-language description players see
sourcePlugin - the plugin that caused it
actor - the player who caused it, if known
reference - idempotency key, if any
reversesTxId - the transaction this one reverses, if any
postings - the legs; they sum to zero

public record TxRecord(long txId, Instant time, String type, String memo, String sourcePlugin, @Nullable UUID actor, @Nullable String reference, @Nullable Long reversesTxId, List<Posting> postings) extends Record
A committed transaction, as returned by history lookups and carried by events.
  • Constructor Details

    • TxRecord

      public TxRecord(long txId, Instant time, String type, String memo, String sourcePlugin, @Nullable @Nullable UUID actor, @Nullable @Nullable String reference, @Nullable @Nullable Long reversesTxId, List<Posting> postings)
      Creates an instance of a TxRecord record class.
      Parameters:
      txId - the value for the txId record component
      time - the value for the time record component
      type - the value for the type record component
      memo - the value for the memo record component
      sourcePlugin - the value for the sourcePlugin record component
      actor - the value for the actor record component
      reference - the value for the reference record component
      reversesTxId - the value for the reversesTxId record component
      postings - the value for the postings record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • txId

      public long txId()
      Returns the value of the txId record component.
      Returns:
      the value of the txId record component
    • time

      public Instant time()
      Returns the value of the time record component.
      Returns:
      the value of the time record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • memo

      public String memo()
      Returns the value of the memo record component.
      Returns:
      the value of the memo record component
    • sourcePlugin

      public String sourcePlugin()
      Returns the value of the sourcePlugin record component.
      Returns:
      the value of the sourcePlugin record component
    • actor

      @Nullable public @Nullable UUID actor()
      Returns the value of the actor record component.
      Returns:
      the value of the actor record component
    • reference

      @Nullable public @Nullable String reference()
      Returns the value of the reference record component.
      Returns:
      the value of the reference record component
    • reversesTxId

      @Nullable public @Nullable Long reversesTxId()
      Returns the value of the reversesTxId record component.
      Returns:
      the value of the reversesTxId record component
    • postings

      public List<Posting> postings()
      Returns the value of the postings record component.
      Returns:
      the value of the postings record component