public static final class MonetaryContext.Builder extends AbstractContext.AbstractBuilder<MonetaryContext.Builder>
MonetaryContext using a fluent API.
This class is not serializable and not thread-safe.attributes| Constructor and Description |
|---|
MonetaryContext.Builder()
Creates a new
MonetaryContext.Builder. |
MonetaryContext.Builder(java.lang.Class<? extends MonetaryAmount> amountType)
Creates a new
MonetaryContext.Builder. |
MonetaryContext.Builder(MonetaryContext context)
Creates a new
MonetaryContext.Builder and uses the given context to
initialize this instance. |
| Modifier and Type | Method and Description |
|---|---|
MonetaryContext |
create()
Builds a new instance of
MonetaryContext. |
MonetaryContext.Builder |
setAmountType(java.lang.Class<? extends MonetaryAmount> amountType)
Sets a fixed scale, hereby setting both
minScale, maxScale to
fixedScale. |
MonetaryContext.Builder |
setFixedScale(boolean fixedScale)
Sets a fixed scale, hereby setting both
minScale, maxScale to
fixedScale. |
MonetaryContext.Builder |
setFlavor(MonetaryContext.AmountFlavor flavor)
Sets a fixed scale, hereby setting both
minScale, maxScale to
fixedScale. |
MonetaryContext.Builder |
setMaxScale(int maxScale)
Sets a maximal scale.
|
MonetaryContext.Builder |
setPrecision(int precision)
Sets the maximal precision supported.
|
java.lang.String |
toString() |
public MonetaryContext.Builder()
MonetaryContext.Builder.public MonetaryContext.Builder(java.lang.Class<? extends MonetaryAmount> amountType)
MonetaryContext.Builder.amountType - the numeric representation type, not null.public MonetaryContext.Builder(MonetaryContext context)
MonetaryContext.Builder and uses the given context to
initialize this instance.context - the base MonetaryContext to be used.public MonetaryContext create()
MonetaryContext.create in class AbstractContext.AbstractBuilder<MonetaryContext.Builder>MonetaryContext, never nulljava.lang.IllegalArgumentException - if building of the MonetaryContext fails.public MonetaryContext.Builder setAmountType(java.lang.Class<? extends MonetaryAmount> amountType)
minScale, maxScale to
fixedScale.amountType - the amount type to be used, not null.MonetaryContext.Builder, for chaining.public MonetaryContext.Builder setFixedScale(boolean fixedScale)
minScale, maxScale to
fixedScale.fixedScale - the min/max scale to be used, which must be >=0.MonetaryContext.Builder, for chaining.public MonetaryContext.Builder setFlavor(MonetaryContext.AmountFlavor flavor)
minScale, maxScale to
fixedScale.flavor - the MonetaryContext.AmountFlavor to be used, not null.MonetaryContext.Builder, for chaining.public MonetaryContext.Builder setMaxScale(int maxScale)
maxScale - the maximal scale to be used, which must be >=-1.
-1 means unlimited maximal scale.MonetaryContext.Builder, for chaining.public MonetaryContext.Builder setPrecision(int precision)
precision - the maximal precision, aleays >=0, whereas 0
declares unlimited precision.MonetaryContext.Builder, for chaining.public java.lang.String toString()
toString in class AbstractContext.AbstractBuilder<MonetaryContext.Builder>