barber
barber copied to clipboard
Add a customized localized formatters for DocumentData Duration, Instant, Money types
For example, a DocumentData with a paramter of type Money
could include a lambda on how to format that anytime it is rendered removing the need for every DocumentData constructor to format before construction.
data class RecipientReceipt(
val sender: String,
@BarberField(fomat = { amount ->
Money.of(amount).asCasual()
})
val amount: Money,
val cancelUrl: String,
@BarberField(format = { dateTime -> Instant.of(dateTime).format("YYYY-MM-DD") })
val deposit_expected_at: Instant
) : DocumentData
Instead of this, we can make DocumentData a proto and accept Duration, Instant, and Amount/Money as non-string types, then add configurable formatters as configuration methods to the Barbershop
https://github.com/cashapp/barber/pull/51