- 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 ofExchangeRates a.ExchangeRateProviderdelivers, 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
RateTypean ExchangeRateProvider supports - a time range for which an ExchangeRateProvider delivers rates.
Instances of this class are immutable and thread-safe.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringKEY_RATE_TYPESKey used for the rate types attribute.private static longserialVersionUID-
Fields inherited from class javax.money.AbstractContext
KEY_PROVIDER
-
-
Constructor Summary
Constructors Constructor Description ProviderContext(ProviderContextBuilder builder)Private constructor, used byProviderContextBuilder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<RateType>getRateTypes()Get the deferred flag.static ProviderContextof(java.lang.String provider)Creates a new ProviderContext based on the provider id and rate type(s).static ProviderContextof(java.lang.String provider, RateType rateType, RateType... rateTypes)Creates a new ProviderContext based on the provider id and rate type(s).ProviderContextBuildertoBuilder()Creates aProviderContextBuilderinitialized with this instance's data.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
KEY_RATE_TYPES
static final java.lang.String KEY_RATE_TYPES
Key used for the rate types attribute.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProviderContext
ProviderContext(ProviderContextBuilder builder)
Private constructor, used byProviderContextBuilder.- Parameters:
builder- the Builder.
-
-
Method Detail
-
getRateTypes
public java.util.Set<RateType> getRateTypes()
Get the deferred flag. Exchange rates can be deferred or real.time.- Returns:
- the deferred flag, or {code null}.
-
toBuilder
public ProviderContextBuilder toBuilder()
Creates aProviderContextBuilderinitialized 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 requiredRateTypes, not null- Returns:
- a new
ProviderContextinstance.
-
of
public static ProviderContext of(java.lang.String provider)
Creates a new ProviderContext based on the provider id and rate type(s).- Parameters:
provider- the provider id, not null.- Returns:
- a new
ProviderContextinstance.
-
-