java.lang.Object
javax.money.AbstractContext
javax.money.convert.ConversionContext
- All Implemented Interfaces:
Serializable
This class models a context for which a
ExchangeRate is valid. It allows to define
different settings such as
- the required
RateType, - the required target timestamp
- the required validity duration
- additional non standard or extended attributes determined by the implementations participating in the ExchangeRateProvider chain.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConversionContextConversionContext that queries any conversion available.static final ConversionContextConversionContext querying for any deferred rates.static final ConversionContextConversionContext querying for any historic rates.static final ConversionContextConversionContext querying for any other rates.static final ConversionContextConversionContext querying for real-time rates.private static final longFields inherited from class javax.money.AbstractContext
KEY_PROVIDER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ConversionContextfrom(ProviderContext providerContext, RateType rateType) Creates a new ConversionContext for the givenProviderContextand the givenRateType.Get the provider of this rate.Get the deferred flag.static ConversionContextof()Simple factory method forConversionContext.static ConversionContextSimple factory method forConversionContext.static ConversionContextCreates aConversionContextfor accessing rates of the given type, without specifying the rate's provider.Creates a conversion query builder with the context data from this context instance.Creates a query builder based on this context.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
ANY_CONVERSION
ConversionContext that queries any conversion available. -
DEFERRED_CONVERSION
ConversionContext querying for any deferred rates. -
HISTORIC_CONVERSION
ConversionContext querying for any historic rates. -
REALTIME_CONVERSION
ConversionContext querying for real-time rates. -
OTHER_CONVERSION
ConversionContext querying for any other rates.
-
-
Constructor Details
-
ConversionContext
ConversionContext(ConversionContextBuilder builder) Private constructor, used byConversionContextBuilder.- Parameters:
builder- the Builder.
-
-
Method Details
-
getRateType
Get the deferred flag. Exchange rates can be deferred or real.time.- Returns:
- the deferred flag, or {code null}.
-
getProviderName
Get the provider of this rate. The provider of a rate can have different contexts in different usage scenarios, such as the service type or the stock exchange.- Overrides:
getProviderNamein classAbstractContext- Returns:
- the provider, or {code null}.
-
toBuilder
Creates a conversion query builder with the context data from this context instance.- Returns:
- a corresponding conversion query builder instance, never null.
-
toQueryBuilder
Creates a query builder based on this context.- Returns:
- a new instance of
ConversionQueryBuilder, never null.
-
of
Simple factory method forConversionContext. For more possibilities to initialize aConversionContext, please use aConversionContextBuilder,- Parameters:
provider- the provider name, notnullrateType- the required rate type.- Returns:
- a new instance of
ConversionContext
-
from
Creates a new ConversionContext for the givenProviderContextand the givenRateType.Note: for adding additional attributes use
(ProviderContext, RateType).- Parameters:
providerContext- the provider context, not null.rateType- the rate type, not null.- Returns:
- a corresponding instance of ConversionContext.
-
of
Creates aConversionContextfor accessing rates of the given type, without specifying the rate's provider.- Parameters:
rateType- the required rate type.- Returns:
- a new instance of
ConversionContext
-
of
Simple factory method forConversionContext. For more possibilities to initialize aConversionContext, please use aConversionContextBuilder,- Returns:
- a new instance of
ConversionContext
-