java.lang.Object
javax.money.AbstractContextBuilder<ConversionContextBuilder,ConversionContext>
javax.money.convert.ConversionContextBuilder
public final class ConversionContextBuilder extends AbstractContextBuilder<ConversionContextBuilder,ConversionContext>
Builder class to of
ConversionContext
instances. Instances of
this class are not thread-safe.- Author:
- Anatole Tresch
-
Constructor Summary
Constructors Constructor Description ConversionContextBuilder()
Create a new Builder instance without any provider, e.g. -
Method Summary
Modifier and Type Method Description ConversionContext
build()
Creates a newConversionContext
with the data from this Builder instance.static ConversionContextBuilder
create(ProviderContext context, RateType rateType)
Create a new Builder, hereby using the givenConversionContext
's values as defaults.static ConversionContextBuilder
of()
Creates a newConversionContextBuilder
instance.static ConversionContextBuilder
of(ConversionContext conversionContext)
Creates a newConversionContextBuilder
instance.ConversionContextBuilder
setRateType(RateType rateType)
Set the historic value.Methods inherited from class javax.money.AbstractContextBuilder
importContext, importContext, removeAttributes, set, set, set, set, set, set, set, set, set, setProviderName, toString
-
Constructor Details
-
ConversionContextBuilder
public ConversionContextBuilder()Create a new Builder instance without any provider, e.g. for creating newConversionContext
instances for querying.
-
-
Method Details
-
setRateType
Set the historic value.- Parameters:
rateType
- the rate type- Returns:
- this, for chaining.
-
build
Creates a newConversionContext
with the data from this Builder instance.- Specified by:
build
in classAbstractContextBuilder<ConversionContextBuilder,ConversionContext>
- Returns:
- a new
ConversionContext
. nevernull
.
-
of
Creates a newConversionContextBuilder
instance.- Parameters:
conversionContext
- the conversion context to be used to initialize the new builder instance, not null.- Returns:
- a new
ConversionContextBuilder
instance, never null.
-
of
Creates a newConversionContextBuilder
instance.- Returns:
- a new
ConversionContextBuilder
instance, never null.
-
create
Create a new Builder, hereby using the givenConversionContext
's values as defaults. This allows changing an existingConversionContext
easily.- Parameters:
context
- the provider context, notnull
rateType
- the rate type, not null.- Returns:
- a new
ConversionContextBuilder
instance, never null.
-