java.lang.Object
javax.money.AbstractContextBuilder<AmountFormatContextBuilder,AmountFormatContext>
javax.money.format.AmountFormatContextBuilder
public final class AmountFormatContextBuilder extends AbstractContextBuilder<AmountFormatContextBuilder,AmountFormatContext>
Builder class for creating new instances of
AmountFormatContext
adding detailed
information
about a MonetaryAmountFormat
instance.
Note this class is NOT thread-safe.
- See Also:
MonetaryAmountFormat.getContext()
-
Method Summary
Modifier and Type Method Description AmountFormatContext
build()
Creates a new instance ofAmountFormatContext
that configures a.MonetaryAmountFormat
.static AmountFormatContextBuilder
create(AmountFormatQuery formatQuery)
Creates a newAmountFormatContextBuilder
.static AmountFormatContextBuilder
of(java.lang.String formatName)
Creates a newAmountFormatContextBuilder
.static AmountFormatContextBuilder
of(java.util.Locale locale)
Creates a new defaultAmountFormatContextBuilder
for a formatter based on the locale specific defaults.static AmountFormatContextBuilder
of(AmountFormatContext context)
Creates a newAmountFormatContextBuilder
.AmountFormatContextBuilder
setFormatName(java.lang.String formatName)
Sets a format's name.AmountFormatContextBuilder
setLocale(java.util.Locale locale)
Sets a Locale to be applied.AmountFormatContextBuilder
setMonetaryAmountFactory(MonetaryAmountFactory monetaryAmountBuilder)
Sets theMonetaryContext
to be used, when amount's are parsed.Methods inherited from class javax.money.AbstractContextBuilder
importContext, importContext, removeAttributes, set, set, set, set, set, set, set, set, set, setProviderName, toString
-
Method Details
-
setFormatName
Sets a format's name.- Parameters:
formatName
- the formatName, not null.- Returns:
- the Builder, for chaining.
-
setLocale
Sets a Locale to be applied.- Parameters:
locale
- the locale, not null.- Returns:
- the Builder, for chaining.
-
setMonetaryAmountFactory
public AmountFormatContextBuilder setMonetaryAmountFactory(MonetaryAmountFactory monetaryAmountBuilder)Sets theMonetaryContext
to be used, when amount's are parsed.- Parameters:
monetaryAmountBuilder
- the monetary amount factory, notnull
.- Returns:
- this builder for chaining.
-
build
Creates a new instance ofAmountFormatContext
that configures a.MonetaryAmountFormat
.- Specified by:
build
in classAbstractContextBuilder<AmountFormatContextBuilder,AmountFormatContext>
- Returns:
- a new
AmountFormatContext
instance.
-
create
Creates a newAmountFormatContextBuilder
.- Parameters:
formatQuery
- the baseAmountFormatContext
, notnull
.- Returns:
- a new
AmountFormatContextBuilder
instance, never null.
-
of
Creates a newAmountFormatContextBuilder
.- Parameters:
context
- theAmountFormatContext
- Returns:
- a new
AmountFormatContextBuilder
instance, never null.
-
of
Creates a newAmountFormatContextBuilder
.- Parameters:
formatName
- the target formatNameString
, notnull
.- Returns:
- a new
AmountFormatContextBuilder
instance, never null.
-
of
Creates a new defaultAmountFormatContextBuilder
for a formatter based on the locale specific defaults.- Parameters:
locale
- the targetLocale
, notnull
.- Returns:
- a new
AmountFormatContextBuilder
instance, never null.
-