java.lang.Object
javax.money.AbstractContext
javax.money.convert.ProviderContext
- All Implemented Interfaces:
java.io.Serializable
public final class ProviderContext extends AbstractContext
This class describes what kind of
ExchangeRate
s a .ExchangeRateProvider
delivers, including the provider's name, rate type and additional data.
By default such a context supports the following attributes:
- a unique non localizable provider name. This provider name is also used to identify a concrete instance of ExchangeRateProvider.
- a set of
RateType
an ExchangeRateProvider supports - a time range for which an ExchangeRateProvider delivers rates.
Instances of this class are immutable and thread-safe.
- Author:
- Anatole Tresch, Werner Keil
- See Also:
- Serialized Form
-
Field Summary
-
Method Summary
Modifier and Type Method Description java.util.Set<RateType>
getRateTypes()
Get the deferred flag.static ProviderContext
of(java.lang.String provider)
Creates a new ProviderContext based on the provider id and rate type(s).static ProviderContext
of(java.lang.String provider, RateType rateType, RateType... rateTypes)
Creates a new ProviderContext based on the provider id and rate type(s).ProviderContextBuilder
toBuilder()
Creates aProviderContextBuilder
initialized with this instance's data.
-
Method Details
-
getRateTypes
Get the deferred flag. Exchange rates can be deferred or real.time.- Returns:
- the deferred flag, or {code null}.
-
toBuilder
Creates aProviderContextBuilder
initialized with this instance's data.- Returns:
- a new
ProviderContextBuilder
, nevernull
.
-
of
public static ProviderContext of(java.lang.String provider, RateType rateType, RateType... rateTypes)Creates a new ProviderContext based on the provider id and rate type(s).- Parameters:
provider
- the provider id, not null.rateType
- the requiredRateType
, not null.rateTypes
- the requiredRateType
s, not null- Returns:
- a new
ProviderContext
instance.
-
of
Creates a new ProviderContext based on the provider id and rate type(s).- Parameters:
provider
- the provider id, not null.- Returns:
- a new
ProviderContext
instance.
-