nl.hiddewieringa.money.MonetaryContextExtensions.kt Maven / Gradle / Ivy
package nl.hiddewieringa.money
import javax.money.MonetaryAmount
import javax.money.MonetaryContext
import javax.money.MonetaryContextBuilder
/**
* @see MonetaryContextBuilder.of
*/
fun monetaryContext(init: MonetaryContextBuilder.() -> Unit = {}): MonetaryContext =
MonetaryContextBuilder
.of()
.apply(init)
.build()
/**
* @see MonetaryContextBuilder.of
*/
fun typedMonetaryContext(amountType: Class, init: MonetaryContextBuilder.() -> Unit = {}): MonetaryContext =
MonetaryContextBuilder
.of(amountType)
.apply(init)
.build()
/**
* @see MonetaryContextBuilder.of
*/
inline fun typedMonetaryContext(noinline init: MonetaryContextBuilder.() -> Unit = {}): MonetaryContext =
typedMonetaryContext(A::class.java, init)
/**
* @see MonetaryContextBuilder.of
*/
fun monetaryContext(monetaryContext: MonetaryContext, init: MonetaryContextBuilder.() -> Unit = {}): MonetaryContext =
MonetaryContextBuilder
.of(monetaryContext)
.apply(init)
.build()
© 2015 - 2025 Weber Informatics LLC | Privacy Policy