java.lang.Object
dev.hloth.zgztransport.TransactionBuilder
Collects the fields of a
Transaction one at a time, which reads
better than a constructor of ten arguments and cannot mix up the counters
that sit next to each other.
The product id, the amount, the counters and the network flag start at zero.
The stop, the route, the kind and the timestamp have no default and have to
be set. Nothing is checked until build() runs.
Transaction ride = Transaction.builder().productId(0x02).amount(550).consecutivePayments(1).stop(new Stop.Urban(500))
.route(new Route(31)).kind(new TransactionKind.Journey(Direction.TWO)).dutyTrip(7)
.createdAt(CardDateTime.of(2026, 8, 26, 9, 41, 27)).sequence(1).build();
-
Method Summary
Modifier and TypeMethodDescriptionamount(int amount) build()Builds the transaction.consecutivePayments(int consecutivePayments) createdAt(CardDateTime createdAt) dutyTrip(int dutyTrip) kind(TransactionKind kind) networkFlag(int networkFlag) productId(int productId) sequence(int sequence)
-
Method Details
-
productId
-
networkFlag
-
amount
-
consecutivePayments
-
stop
-
route
-
kind
-
dutyTrip
-
createdAt
-
sequence
-
build
Builds the transaction.- Returns:
- the transaction
- Throws:
IllegalArgumentException- if a field is outside the range its byte allowsNullPointerException- if a field that has no default was not set
-