Class TransactionBuilder

java.lang.Object
dev.hloth.zgztransport.TransactionBuilder

public final class TransactionBuilder extends Object
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();