java.lang.Object
javax.money.AbstractContextBuilder<ProviderContextBuilder,ProviderContext>
javax.money.convert.ProviderContextBuilder
public final class ProviderContextBuilder
extends AbstractContextBuilder<ProviderContextBuilder,ProviderContext>
Builder class to of
ProviderContext instances. Instances of
this class are not thread-safe.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateProviderContextBuilder(String provider, Collection<RateType> rateTypes) Create a new Builder instance.privateProviderContextBuilder(String provider, RateType rateType, RateType... rateTypes) Create a new Builder instance.privateProviderContextBuilder(ProviderContext context) Create a new Builder, hereby using the givenProviderContext's values as defaults. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a newProviderContextwith the data from this Builder instance.static ProviderContextBuildercreate(ProviderContext context) Create a new ProviderContextBuilder, hereby using the givenProviderContext's values as defaults.static ProviderContextBuilderof(String provider, Collection<RateType> rateTypes) Create a new ProviderContextBuilder instance.static ProviderContextBuilderCreate a new ProviderContextBuilder instance.setRateTypes(Collection<RateType> rateTypes) Set the rate types.setRateTypes(RateType... rateTypes) Set the rate types.Methods inherited from class javax.money.AbstractContextBuilder
importContext, importContext, removeAttributes, set, set, set, set, set, set, set, set, set, setProviderName, toString
-
Constructor Details
-
ProviderContextBuilder
Create a new Builder instance.- Parameters:
provider- the provider name, notnull.rateTypes- the rate types, not null and not empty.
-
ProviderContextBuilder
Create a new Builder instance.- Parameters:
provider- the provider name, notnull.rateTypes- the rate types, not null and not empty.
-
ProviderContextBuilder
Create a new Builder, hereby using the givenProviderContext's values as defaults. This allows changing an existingProviderContexteasily.- Parameters:
context- the context, notnull
-
-
Method Details
-
setRateTypes
Set the rate types.- Parameters:
rateTypes- the rate types, not null and not empty.- Returns:
- this, for chaining.
- Throws:
IllegalArgumentException- when not at least oneRateTypeis provided.
-
setRateTypes
Set the rate types.- Parameters:
rateTypes- the rate types, not null and not empty.- Returns:
- this, for chaining.
- Throws:
IllegalArgumentException- when not at least oneRateTypeis provided.
-
build
Creates a newProviderContextwith the data from this Builder instance.- Specified by:
buildin classAbstractContextBuilder<ProviderContextBuilder,ProviderContext> - Returns:
- a new
ProviderContext. nevernull.
-
create
Create a new ProviderContextBuilder, hereby using the givenProviderContext's values as defaults. This allows changing an existingProviderContexteasily.- Parameters:
context- the context, notnull- Returns:
- a new
ProviderContextBuilderinstance, never null.
-
of
Create a new ProviderContextBuilder instance.- Parameters:
provider- the provider name, notnull.rateType- the requiredRateType, not nullrateTypes- the rate types, not null and not empty.- Returns:
- a new
ProviderContextBuilderinstance, never null.
-
of
Create a new ProviderContextBuilder instance.- Parameters:
provider- the provider name, notnull.rateTypes- the rate types, not null and not empty.- Returns:
- a new
ProviderContextBuilderinstance, never null.
-