Record Class TransferResult

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.transfer.TransferResult
Record Components:
reason - why less than requested was moved, if known

public record TransferResult(@NotNull TransferResult.Status status, long requested, long moved, @Nullable MachineError reason) extends Record
Outcome of a transfer (ARCHITECTURE.md ยง10.3). Simulation is a mode (an aborted transaction), not an outcome.
  • Constructor Details

    • TransferResult

      public TransferResult(@NotNull @NotNull TransferResult.Status status, long requested, long moved, @Nullable @Nullable MachineError reason)
      Creates an instance of a TransferResult record class.
      Parameters:
      status - the value for the status record component
      requested - the value for the requested record component
      moved - the value for the moved record component
      reason - the value for the reason record component
  • Method Details

    • of

      @NotNull public static @NotNull TransferResult of(long requested, long moved, @Nullable @Nullable MachineError reason)
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • status

      @NotNull public @NotNull TransferResult.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • requested

      public long requested()
      Returns the value of the requested record component.
      Returns:
      the value of the requested record component
    • moved

      public long moved()
      Returns the value of the moved record component.
      Returns:
      the value of the moved record component
    • reason

      @Nullable public @Nullable MachineError reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component