Record Class BlockchainRestController.TransactionRequest

java.lang.Object
java.lang.Record
com.privatechain.examples.spring.BlockchainRestController.TransactionRequest
Record Components:
receiverAddress - destination blockchain address (non-null, non-blank)
amount - transfer amount (≥ 0)
currency - ISO-4217 currency code (non-null, non-blank)
Enclosing class:
BlockchainRestController

public static record BlockchainRestController.TransactionRequest(String receiverAddress, BigDecimal amount, String currency) extends Record
Immutable request body for BlockchainRestController.submitTransaction(com.privatechain.examples.spring.BlockchainRestController.TransactionRequest).

Uses a Java 16+ record so Spring MVC can deserialize it via Jackson without any additional configuration — records expose their components as public accessor methods, which Jackson uses for both serialization and deserialization when the constructor is annotated with JsonCreator.

  • Constructor Details

  • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • receiverAddress

      public String receiverAddress()
      Returns the value of the receiverAddress record component.
      Returns:
      the value of the receiverAddress record component
    • amount

      public BigDecimal amount()
      Returns the value of the amount record component.
      Returns:
      the value of the amount record component
    • currency

      public String currency()
      Returns the value of the currency record component.
      Returns:
      the value of the currency record component