Top Description Fields Constructors Methods
javax.money

public final Class RoundingContext

extends AbstractContext
implements Serializable, CurrencySupplier
Class Inheritance
All Implemented Interfaces
javax.money.CurrencySupplier, java.io.Serializable
Imports
java.io.Serializable

This class models the spec/configuration for a rounding, modeled as javax.money.MonetaryRounding in a platform independent way. Each RoundingContext instance hereby has a roundingId, which links to the javax.money.spi.RoundingProviderSpi that must of the according rounding instance. The default roundingId is default.

A RoundingContext can take up arbitrary attributes that must be documented by the javax.money.spi.RoundingProviderSpi implementations.

Examples for such additional attributes are java.math.RoundingMode, java.math.MathContext, additional regional information, e.g. if a given rounding is targeting cash rounding.

This class is immutable, serializable, thread-safe.

Author
Anatole Tresch

Field Summary

Modifier and TypeField and Description
pack-priv static final String
KEY_ROUNDING_NAME

Attribute key used for the rounding name.

private static final long
Inherited from javax.money.AbstractContext:
dataKEY_PROVIDER

Constructor Summary

AccessConstructor and Description
pack-priv
RoundingContext(RoundingContextBuilder
the corresponding builder, not null.
builder
)

Constructor, used from the javax.money.RoundingContextBuilder.

Method Summary

Modifier and TypeMethod and Description
public CurrencyUnit

Returns:

the target CurrencyUnit, or null.
getCurrency
()

Implements javax.money.CurrencySupplier.getCurrency.

Get the basic javax.money.CurrencyUnit, which is based for this rounding type.
public String

Returns:

the rounding id, or null.
getRoundingName
()

Get the (custom) rounding id.

public RoundingContextBuilder

Returns:

a new Builder instance, preinitialized with the values from this instance.
toBuilder
()

Allows to convert a instance into the corresponding javax.money.CurrencyContextBuilder, which allows to change the values and of another javax.money.CurrencyContext instance.

Inherited from javax.money.AbstractContext:
equalsgetgetgetBooleangetDoublegetFloatgetIntgetKeysgetLonggetProviderNamegetTextgetTypehashCodeisEmptytoString

Field Detail

KEY_ROUNDING_NAMEback to summary
pack-priv static final String KEY_ROUNDING_NAME

Attribute key used for the rounding name.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javax.money.AbstractContext.serialVersionUID.

Constructor Detail

RoundingContextback to summary
pack-priv RoundingContext(RoundingContextBuilder builder)

Constructor, used from the javax.money.RoundingContextBuilder.

Parameters
builder:RoundingContextBuilder

the corresponding builder, not null.

Method Detail

getCurrencyback to summary
public CurrencyUnit getCurrency()

Implements javax.money.CurrencySupplier.getCurrency.

Get the basic javax.money.CurrencyUnit, which is based for this rounding type.

Returns:CurrencyUnit

the target CurrencyUnit, or null.

getRoundingNameback to summary
public String getRoundingName()

Get the (custom) rounding id.

Returns:String

the rounding id, or null.

toBuilderback to summary
public RoundingContextBuilder toBuilder()

Allows to convert a instance into the corresponding javax.money.CurrencyContextBuilder, which allows to change the values and of another javax.money.CurrencyContext instance.

Returns:RoundingContextBuilder

a new Builder instance, preinitialized with the values from this instance.