public final class MonetaryContext extends AbstractContext implements java.io.Serializable
MonetaryAmount in a
platform independent way. It provides information about
java.math.RoundingMode.
| Modifier and Type | Class and Description |
|---|---|
static class |
MonetaryContext.AmountFlavor
Defines the possible flavors of
MonetaryAmount implementations. |
static class |
MonetaryContext.Builder
This class allows to build and create instances of
MonetaryContext using a fluent API. |
AbstractContext.AbstractBuilder<B extends AbstractContext.AbstractBuilder<B>>attributes| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static MonetaryContext |
from(MonetaryContext context,
java.lang.Class<? extends MonetaryAmount> amountType)
Creates a new
MonetaryContext targeting the the given amount
type, using the given MonetaryContext (so converting it). |
MonetaryContext.AmountFlavor |
getAmountFlavor()
Get the
MonetaryContext.AmountFlavor. |
java.lang.Class<? extends MonetaryAmount> |
getAmountType()
Access the amount implementation type for the
MonetaryAmount
implementation. |
int |
getMaxScale()
Get the maximal scale supported, always
>= -1. |
int |
getPrecision()
Returns the
precision setting. |
int |
hashCode() |
boolean |
isFixedScale()
Allows to check if
minScale == maxScale. |
java.lang.String |
toString() |
getAttribute, getAttribute, getAttributeTypes, getNamedAttribute, getNamedAttribute, set, setpublic boolean equals(java.lang.Object obj)
equals in class AbstractContextpublic static MonetaryContext from(MonetaryContext context, java.lang.Class<? extends MonetaryAmount> amountType)
MonetaryContext targeting the the given amount
type, using the given MonetaryContext (so converting it).context - the MonetaryContext to be used.amountType - the target amount type.MonetaryContext, not null.public MonetaryContext.AmountFlavor getAmountFlavor()
MonetaryContext.AmountFlavor.MonetaryAmounts MonetaryContext.AmountFlavor.public java.lang.Class<? extends MonetaryAmount> getAmountType()
MonetaryAmount
implementation.null.public int getMaxScale()
>= -1. Fixed scaled
numbers will have scale==maxScale for all values. -1
declares the maximal scale to be unlimited.>= -1public int getPrecision()
precision setting. This value is always non-negative.int which is the value of the precision
settingpublic int hashCode()
hashCode in class AbstractContextpublic boolean isFixedScale()
minScale == maxScale.true if minScale == maxScale.public java.lang.String toString()
toString in class AbstractContext