java.lang.Object
java.lang.Record
dev.hloth.zgztransport.TransactionKind.Journey
- Record Components:
direction- the direction travelled along the route
- All Implemented Interfaces:
TransactionKind
- Enclosing interface:
TransactionKind
public static record TransactionKind.Journey(Direction direction)
extends Record
implements TransactionKind
A ride, paid out of the balance or free as a transfer.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.hloth.zgztransport.TransactionKind
TransactionKind.Journey, TransactionKind.TopUp -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.intvalue()The byte the card stores.
-
Constructor Details
-
Journey
Checks that the direction is present.- Throws:
NullPointerException- if the direction is null
-
-
Method Details
-
value
public int value()Description copied from interface:TransactionKindThe byte the card stores.- Specified by:
valuein interfaceTransactionKind- Returns:
- byte 8 of the record
-
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). -
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-