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 amount, the counters and the network flag start at zero, the values a top up carries. The product, 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().cardType(CardType.AVANZA_TOP_UP).amount(550).consecutivePayments(1)
 		.stop(new Stop.Urban(500)).route(new Route(31)).kind(new TransactionKind.Journey(Direction.TWO))
 		.runCounter(7).createdAt(CardDateTime.of(2026, 8, 26, 9, 41, 27)).sequence(1).build();