Interface CurrencyContextProvider<T>
-
- Type Parameters:
T- the repository domain type that this currency provider manages
- All Known Implementing Classes:
CompositeCurrencyContextProvider
public interface CurrencyContextProvider<T>While mapping from a repository domain that stores a numeric value to a business domain that utilizes a
MonetaryAmountthis gives the facilities to resolve a currency for the given source repository object.This interface can be used as standalone instances to configure the
MonetaryMapperMemberwith. TheMonetaryMapperMemberwill first consult the repository domain itself (via theCurrencyProviderinterface) 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 implementsCurrencyProvideror there are no configured currency providers, the default system currency is used.During Jackson deserialization this is used to initialize
CurrencyContextAwareobjects- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
CurrencyProvider,MonetaryMapperMember
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancanHandle(Object source, ContextInfo contextInfo)Whether or not this can handle the resolution for the given source.com.broadleafcommerce.money.CurrencyContextgetContext(T source, ContextInfo contextInfo)Get the currency from a source object
-
-
-
Method Detail
-
getContext
@Nullable com.broadleafcommerce.money.CurrencyContext getContext(@NonNull T source, @Nullable ContextInfo contextInfo)Get the currency from a source object- Parameters:
source- what to use in the consideration of a currency- Returns:
- a
CurrencyUnitor null if not handled.
-
canHandle
default boolean canHandle(@NonNull Object source, @Nullable ContextInfo contextInfo)Whether or not this can handle the resolution for the given source. Default behavior is to match whether or not this implementation declares whether or not it can handle this or child classes- Parameters:
source- the repository domain when mapping from a repository or the business domain instance when deserializing from Jackson- Returns:
- whether or not this can be handled
-
-