java.lang.Object
javax.money.AbstractContextBuilder<B,C>
javax.money.AbstractQueryBuilder<RoundingQueryBuilder,RoundingQuery>
javax.money.RoundingQueryBuilder
public final class RoundingQueryBuilder extends AbstractQueryBuilder<RoundingQueryBuilder,RoundingQuery>
Builder used to construct new instances of RoundingQuery}.
Note this class is NOT thread-safe.
-
Method Summary
Modifier and Type Method Description RoundingQuerybuild()Creates a new instance ofRoundingQuery.static RoundingQueryBuilderof()static RoundingQueryBuilderof(RoundingQuery roundingQuery)Creates a new RoundingQueryBuilder.RoundingQueryBuildersetCurrency(CurrencyUnit currencyUnit)Sets the targetCurrencyUnit, which defines a rounding targeting a concreteCurrencyUnit.RoundingQueryBuildersetRoundingName(java.lang.String roundingName)Sets the rounding names of theMonetaryRoundinginstances.RoundingQueryBuildersetScale(int scale)Sets the target scale.Methods inherited from class javax.money.AbstractQueryBuilder
set, setProviderName, setProviderNames, setProviderNames, setTargetTypeMethods inherited from class javax.money.AbstractContextBuilder
importContext, importContext, removeAttributes, set, set, set, set, set, set, set, set, set, toString
-
Method Details
-
setRoundingName
Sets the rounding names of theMonetaryRoundinginstances. This method allows to access theMonetaryRoundinginstances by passing a name, which most of the time identifies a certain rounding instance. Each entry is first matched as name on equality. If no instance with such a name exists, the value passed is interpreted as a regular expression to lookup roundings.- Parameters:
roundingName- the (custom) rounding name expression, notnull.- Returns:
- this instance for chaining
-
setScale
Sets the target scale. This allows to define the scale required. If not specified as additional attribute, by default, RoundingMode.HALF_EVEN is used hereby.- Parameters:
scale- the target scale, >0.- Returns:
- this instance for chaining
-
setCurrency
Sets the targetCurrencyUnit, which defines a rounding targeting a concreteCurrencyUnit. Typically this determines all other properties, such as scale and the concrete rounding algorithm. With rounding names, depending on the implementation, additional subselections are possible. Similarly additional attributes can be used to select special rounding instances, e.g. for cash rounding.- Parameters:
currencyUnit- the targetCurrencyUnitnot null.- Returns:
- this instance for chaining
-
build
Creates a new instance ofRoundingQuery.- Specified by:
buildin classAbstractQueryBuilder<RoundingQueryBuilder,RoundingQuery>- Returns:
- a new
RoundingQueryinstance.
-
of
- Returns:
- Creates a new RoundingQueryBuilder.
-
of
Creates a new RoundingQueryBuilder.- Parameters:
roundingQuery- the rounding query, used as a template, not null.- Returns:
- a new
RoundingQueryBuilderinstance, never null.
-