Top Description Methods
org.javamoney.moneta.function

public Interface MonetaryRoundedFactory

Known Direct Implementers
org.javamoney.moneta.function.DefaultMonetaryRoundedFactory
Static Imports
java.util.Objects.requireNonNull

this interface is used to create org.javamoney.moneta.RoundedMoney using the MonetaryOperator as rounding.
Author
Otavio Santana
Since
1.0.1
See Also
MonetaryRoundedFactory#of(MathContext), MonetaryRoundedFactory#of(MonetaryOperator), MonetaryRoundedFactory#withRoundingMode(RoundingMode)

Method Summary

Modifier and TypeMethod and Description
public MonetaryAmount

Returns:

the MonetaryAmount from number and CurrencyUnit
create
(Number
the amount, not null.
number
,
CurrencyUnit
the currency, not null.
currencyUnit
)

Create a MonetaryAmount with Number, CurrencyUnit and the MonetaryOperator as rounding operator given in this factory with the MonetaryRoundedFactory#getRoundingOperator().

public MonetaryOperator

Returns:

the rounding operator
getRoundingOperator
()

return the MonetaryOperator as rounding operator

public static MonetaryRoundedFactory

Returns:

the factory using the MathContextRoundedOperator
of
(MathContext
the mathContext that will be used to create the PrecisionContextRoundedOperator
mathContext
)

Create the MonetaryRoundedFactory using the PrecisionContextRoundedOperator as rounding operator.

public static MonetaryRoundedFactory

Returns:

the factory using the MathContextRoundedOperator
of
(MonetaryOperator
a custom MonetaryOperator that will be used in this factory
roundingOperator
)

Create the MonetaryRoundedFactory using a custom MonetaryOperator as rounding operator.

public static MonetaryRoundedFactoryBuilder

Returns:

the builder to set scale, precision or both
withRoundingMode
(RoundingMode
the rounding mode, not null.
roundingMode
)

Create a factory to MonetaryRoundedFactoryBuilder with this factory is possible make a custom MonetaryOperator as rounding operator, setting the precision, scale or both.

Method Detail

createback to summary
public MonetaryAmount create(Number number, CurrencyUnit currencyUnit)

Create a MonetaryAmount with Number, CurrencyUnit and the MonetaryOperator as rounding operator given in this factory with the MonetaryRoundedFactory#getRoundingOperator(). The implementation will org.javamoney.moneta.RoundedMoney

Parameters
number:Number

the amount, not null.

currencyUnit:CurrencyUnit

the currency, not null.

Returns:MonetaryAmount

the MonetaryAmount from number and CurrencyUnit

getRoundingOperatorback to summary
public MonetaryOperator getRoundingOperator()

return the MonetaryOperator as rounding operator

Returns:MonetaryOperator

the rounding operator

ofback to summary
public static MonetaryRoundedFactory of(MathContext mathContext)

Create the MonetaryRoundedFactory using the PrecisionContextRoundedOperator as rounding operator.

Parameters
mathContext:MathContext

the mathContext that will be used to create the PrecisionContextRoundedOperator

Returns:MonetaryRoundedFactory

the factory using the MathContextRoundedOperator

Exceptions
NullPointerException:
if mathContext is null
See Also
PrecisionContextRoundedOperator#of(MathContext), PrecisionContextRoundedOperator
ofback to summary
public static MonetaryRoundedFactory of(MonetaryOperator roundingOperator)

Create the MonetaryRoundedFactory using a custom MonetaryOperator as rounding operator.

Parameters
roundingOperator:MonetaryOperator

a custom MonetaryOperator that will be used in this factory

Returns:MonetaryRoundedFactory

the factory using the MathContextRoundedOperator

Exceptions
NullPointerException:
if roundingOperator is null
withRoundingModeback to summary
public static MonetaryRoundedFactoryBuilder withRoundingMode(RoundingMode roundingMode)

Create a factory to MonetaryRoundedFactoryBuilder with this factory is possible make a custom MonetaryOperator as rounding operator, setting the precision, scale or both.

Parameters
roundingMode:RoundingMode

the rounding mode, not null.

Returns:MonetaryRoundedFactoryBuilder

the builder to set scale, precision or both

Exceptions
NullPointerException:
if roundingMode is null
See Also
ScaleRoundedOperator, PrecisionContextRoundedOperator, PrecisionScaleRoundedOperator, RoundingMode