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 AmountFormatContextbuild()Creates a new instance ofAmountFormatContextthat configures a.MonetaryAmountFormat.static AmountFormatContextBuildercreate(AmountFormatQuery formatQuery)Creates a newAmountFormatContextBuilder.static AmountFormatContextBuilderof(java.lang.String formatName)Creates a newAmountFormatContextBuilder.static AmountFormatContextBuilderof(java.util.Locale locale)Creates a new defaultAmountFormatContextBuilderfor a formatter based on the locale specific defaults.static AmountFormatContextBuilderof(AmountFormatContext context)Creates a newAmountFormatContextBuilder.AmountFormatContextBuildersetFormatName(java.lang.String formatName)Sets a format's name.AmountFormatContextBuildersetLocale(java.util.Locale locale)Sets a Locale to be applied.AmountFormatContextBuildersetMonetaryAmountFactory(MonetaryAmountFactory monetaryAmountBuilder)Sets theMonetaryContextto 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 theMonetaryContextto be used, when amount's are parsed.- Parameters:
monetaryAmountBuilder- the monetary amount factory, notnull.- Returns:
- this builder for chaining.
-
build
Creates a new instance ofAmountFormatContextthat configures a.MonetaryAmountFormat.- Specified by:
buildin classAbstractContextBuilder<AmountFormatContextBuilder,AmountFormatContext>- Returns:
- a new
AmountFormatContextinstance.
-
create
Creates a newAmountFormatContextBuilder.- Parameters:
formatQuery- the baseAmountFormatContext, notnull.- Returns:
- a new
AmountFormatContextBuilderinstance, never null.
-
of
Creates a newAmountFormatContextBuilder.- Parameters:
context- theAmountFormatContext- Returns:
- a new
AmountFormatContextBuilderinstance, never null.
-
of
Creates a newAmountFormatContextBuilder.- Parameters:
formatName- the target formatNameString, notnull.- Returns:
- a new
AmountFormatContextBuilderinstance, never null.
-
of
Creates a new defaultAmountFormatContextBuilderfor a formatter based on the locale specific defaults.- Parameters:
locale- the targetLocale, notnull.- Returns:
- a new
AmountFormatContextBuilderinstance, never null.
-