Package no.priv.bang.ukelonn.beans
Record Class Transaction
java.lang.Object
java.lang.Record
no.priv.bang.ukelonn.beans.Transaction
public record Transaction(int id, TransactionType transactionType, Date transactionTime, double transactionAmount, boolean paidOut)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for theidrecord component.private final booleanThe field for thepaidOutrecord component.private final doubleThe field for thetransactionAmountrecord component.private final DateThe field for thetransactionTimerecord component.private final TransactionTypeThe field for thetransactionTyperecord component. -
Constructor Summary
ConstructorsConstructorDescriptionTransaction(int id, TransactionType transactionType, Date transactionTime, double transactionAmount, boolean paidOut) Creates an instance of aTransactionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.getName()final inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.booleanpaidOut()Returns the value of thepaidOutrecord component.final StringtoString()Returns a string representation of this record class.doubleReturns the value of thetransactionAmountrecord component.Returns the value of thetransactionTimerecord component.Returns the value of thetransactionTyperecord component.static Transaction.Builderwith()static Transaction.Builderwith(Transaction transaction)
-
Field Details
-
id
private final int idThe field for theidrecord component. -
transactionType
The field for thetransactionTyperecord component. -
transactionTime
The field for thetransactionTimerecord component. -
transactionAmount
private final double transactionAmountThe field for thetransactionAmountrecord component. -
paidOut
private final boolean paidOutThe field for thepaidOutrecord component.
-
-
Constructor Details
-
Transaction
public Transaction(int id, TransactionType transactionType, Date transactionTime, double transactionAmount, boolean paidOut) Creates an instance of aTransactionrecord class.- Parameters:
id- the value for theidrecord componenttransactionType- the value for thetransactionTyperecord componenttransactionTime- the value for thetransactionTimerecord componenttransactionAmount- the value for thetransactionAmountrecord componentpaidOut- the value for thepaidOutrecord component
-
-
Method Details
-
getName
-
with
-
with
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
public int id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
transactionType
Returns the value of thetransactionTyperecord component.- Returns:
- the value of the
transactionTyperecord component
-
transactionTime
Returns the value of thetransactionTimerecord component.- Returns:
- the value of the
transactionTimerecord component
-
transactionAmount
public double transactionAmount()Returns the value of thetransactionAmountrecord component.- Returns:
- the value of the
transactionAmountrecord component
-
paidOut
public boolean paidOut()Returns the value of thepaidOutrecord component.- Returns:
- the value of the
paidOutrecord component
-