Package com.privatechain.examples.spring
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 Summary
ConstructorsConstructorDescriptionTransactionRequest(String receiverAddress, BigDecimal amount, String currency) Compact canonical constructor — validates required fields. -
Method Summary
Modifier and TypeMethodDescriptionamount()Returns the value of theamountrecord component.currency()Returns the value of thecurrencyrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thereceiverAddressrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TransactionRequest
Compact canonical constructor — validates required fields.- Throws:
NullPointerException- if any field is nullIllegalArgumentException- if any string field is blank or amount is negative
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
receiverAddress
Returns the value of thereceiverAddressrecord component.- Returns:
- the value of the
receiverAddressrecord component
-
amount
Returns the value of theamountrecord component.- Returns:
- the value of the
amountrecord component
-
currency
Returns the value of thecurrencyrecord component.- Returns:
- the value of the
currencyrecord component
-