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 MonetaryContext
build()
Creates a new instance ofMonetaryAmountFactoryQuery
.static MonetaryContextBuilder
of()
Creates a new builder, hereby the target implementation type is required.static MonetaryContextBuilder
of(java.lang.Class<? extends MonetaryAmount> amountType)
Creates a new builder, hereby the target implementation type is required.static MonetaryContextBuilder
of(MonetaryContext monetaryContext)
Creates a new builder, using an existingMonetaryContext
as a template.MonetaryContextBuilder
setAmountType(java.lang.Class<? extends MonetaryAmount> amountType)
Set the MonetaryAmount implementation class.MonetaryContextBuilder
setFixedScale(boolean fixedScale)
Set the flag if the scale should fixed.MonetaryContextBuilder
setMaxScale(int maxScale)
Set the maximal scale to be supported.MonetaryContextBuilder
setPrecision(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:
build
in classAbstractContextBuilder<MonetaryContextBuilder,MonetaryContext>
- Returns:
- a new
MonetaryAmountFactoryQuery
instance.
-
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
MonetaryContextBuilder
instance, never null.
-
of
Creates a new builder, using an existingMonetaryContext
as a template.- Returns:
- a new
MonetaryContextBuilder
instance, 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
MonetaryContextBuilder
instance, never null.
-