java.lang.Object
javax.money.AbstractContextBuilder<MonetaryContextBuilder,MonetaryContext>
javax.money.MonetaryContextBuilder
public final class MonetaryContextBuilder extends AbstractContextBuilder<MonetaryContextBuilder,MonetaryContext>
Builder class for creating new instances of
MonetaryContext adding detailed information
about a MonetaryAmount instance.
Note this class is NOT thread-safe.
- See Also:
MonetaryAmount.getContext()
-
Method Summary
Modifier and Type Method Description MonetaryContextbuild()Creates a new instance ofMonetaryAmountFactoryQuery.static MonetaryContextBuilderof()Creates a new builder, hereby the target implementation type is required.static MonetaryContextBuilderof(java.lang.Class<? extends MonetaryAmount> amountType)Creates a new builder, hereby the target implementation type is required.static MonetaryContextBuilderof(MonetaryContext monetaryContext)Creates a new builder, using an existingMonetaryContextas a template.MonetaryContextBuildersetAmountType(java.lang.Class<? extends MonetaryAmount> amountType)Set the MonetaryAmount implementation class.MonetaryContextBuildersetFixedScale(boolean fixedScale)Set the flag if the scale should fixed.MonetaryContextBuildersetMaxScale(int maxScale)Set the maximal scale to be supported.MonetaryContextBuildersetPrecision(int precision)Set the required precision.Methods inherited from class javax.money.AbstractContextBuilder
importContext, importContext, removeAttributes, set, set, set, set, set, set, set, set, set, setProviderName, toString
-
Method Details
-
setMaxScale
Set the maximal scale to be supported.- Parameters:
maxScale- the max scale, >= 0.- Returns:
- this builder for chaining.
-
setPrecision
Set the required precision.- Parameters:
precision- the precision, >= 0, 0 meaning unlimited.- Returns:
- this builder for chaining.
-
setFixedScale
Set the flag if the scale should fixed.- Parameters:
fixedScale- the fixed scale flag.- Returns:
- this builder for chaining.
-
setAmountType
Set the MonetaryAmount implementation class.- Parameters:
amountType- the target amount type, not null.- Returns:
- the implementation class of the containing amount instance, never null.
- See Also:
MonetaryAmount.getContext()
-
build
Creates a new instance ofMonetaryAmountFactoryQuery.- Specified by:
buildin classAbstractContextBuilder<MonetaryContextBuilder,MonetaryContext>- Returns:
- a new
MonetaryAmountFactoryQueryinstance.
-
of
Creates a new builder, hereby the target implementation type is required. This can be used to explicitly acquire a specific amount type and additionally configure the amount factory with the attributes in this query.- Returns:
- a new
MonetaryContextBuilderinstance, never null.
-
of
Creates a new builder, using an existingMonetaryContextas a template.- Returns:
- a new
MonetaryContextBuilderinstance, never null.
-
of
Creates a new builder, hereby the target implementation type is required. This can be used to explicitly acquire a specific amount type and additionally configure the amount factory with the attributes in this query.- Parameters:
amountType- the target amount type, not null.- Returns:
- a new
MonetaryContextBuilderinstance, never null.
-