T
- the repository domain type that this currency provider managespublic interface CurrencyContextProvider<T>
While mapping from a repository domain that stores a numeric value to a business domain that
utilizes a MonetaryAmount
this gives the facilities to resolve a currency for the given
source repository object.
This interface can be used as standalone instances to configure the MonetaryMapperMember
with. The MonetaryMapperMember
will first consult the repository domain itself (via the
CurrencyProvider
interface) to retrieve a "default" currency. It then consults
additionally-configured standalone members to give the ability to override the currency value for
the mapping source. If neither the repository domain implements CurrencyProvider
or there
are no configured currency providers, the default system currency is used.
During Jackson deserialization this is used to initialize CurrencyContextAware
objects
CurrencyProvider
,
MonetaryMapperMember
Modifier and Type | Method and Description |
---|---|
default boolean |
canHandle(Object source,
ContextInfo contextInfo)
Whether or not this can handle the resolution for the given source.
|
com.broadleafcommerce.money.CurrencyContext |
getContext(T source,
ContextInfo contextInfo)
Get the currency from a source object
|
@Nullable com.broadleafcommerce.money.CurrencyContext getContext(@NonNull T source, @Nullable ContextInfo contextInfo)
source
- what to use in the consideration of a currencyCurrencyUnit
or null if not handled.default boolean canHandle(@NonNull Object source, @Nullable ContextInfo contextInfo)
source
- the repository domain when mapping from a repository or the business domain
instance when deserializing from JacksonCopyright © 2021. All rights reserved.