public final class MonetaryContext extends AbstractContext implements Serializable
MonetaryAmount
in a
platform independent way. It provides information about
RoundingMode
.
This class is immutable, serializable and thread-safe.
KEY_PROVIDER
Modifier and Type | Method and Description |
---|---|
static MonetaryContext |
from(MonetaryAmountFactoryQuery monetaryAmountFactoryQuery,
Class<? extends MonetaryAmount> amountClass)
This method allows to easily of a new MonetaryContext instance from a given
.MonetaryAmountFactoryQuery . |
static MonetaryContext |
from(MonetaryContext monetaryContext,
Class<? extends MonetaryAmount> amountClass)
Creates a new MonetaryContext).
|
Class<? extends MonetaryAmount> |
getAmountType()
Get the MonetaryAmount implementation class.
|
int |
getMaxScale()
Get the maximal scale supported, always
>= -1 . |
int |
getPrecision()
Returns the
precision setting. |
boolean |
isFixedScale()
Allows to check if
minScale == maxScale . |
MonetaryContextBuilder |
toBuilder()
Creates a new builder instances, initialized with the data from this one.
|
public int getPrecision()
precision
setting. This value is always non-negative.int
which is the value of the precision
settingpublic boolean isFixedScale()
minScale == maxScale
.true
if minScale == maxScale
.public int getMaxScale()
>= -1
. Fixed scaled
numbers will have scale==maxScale
for all values. -1
declares the maximal scale to be unlimited.>= -1
public Class<? extends MonetaryAmount> getAmountType()
MonetaryAmount.getContext()
public static MonetaryContext from(MonetaryAmountFactoryQuery monetaryAmountFactoryQuery, Class<? extends MonetaryAmount> amountClass)
.MonetaryAmountFactoryQuery
.monetaryAmountFactoryQuery
- the monetary amount factory query, not null.amountClass
- the targeted implementation type.public static MonetaryContext from(MonetaryContext monetaryContext, Class<? extends MonetaryAmount> amountClass)
monetaryContext
- the base context, not null.amountClass
- the target amount class.public MonetaryContextBuilder toBuilder()
MonetaryContextBuilder
instance, never null.Copyright © 2012–2016 JSR 354 - Expert Group. All rights reserved.