Class NoOpCurrencyConversionService

java.lang.Object
com.broadleafcommerce.pricing.service.NoOpCurrencyConversionService
All Implemented Interfaces:
CurrencyConversionService

public class NoOpCurrencyConversionService extends Object implements CurrencyConversionService
Implementation of CurrencyConversionService that does nothing it always returns false for canCovert(CurrencyUnit, CurrencyUnit) and errors if convert is called.
Author:
Brian Polster (bpolster)
See Also:
  • Constructor Details

    • NoOpCurrencyConversionService

      public NoOpCurrencyConversionService()
  • Method Details

    • canCovert

      public boolean canCovert(javax.money.CurrencyUnit from, javax.money.CurrencyUnit to)
      Always returns false
      Specified by:
      canCovert in interface CurrencyConversionService
      Parameters:
      from - The currency to convert from.
      to - The currency to convert to.
      Returns:
      false
    • convert

      public javax.money.MonetaryAmount convert(javax.money.MonetaryAmount fromAmount, javax.money.CurrencyUnit toCurrency)
      Always throws UnsupportedOperationException. Callers should call canConvert prior to calling the convert operation which in the case of this provider will always return false.
      Specified by:
      convert in interface CurrencyConversionService
      Parameters:
      fromAmount - The MonetaryAmount to convert.
      toCurrency - The currency to convert to.
      Returns:
      UnsupportedOperationException
    • populateCurrencyConversionDetails

      public <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo> void populateCurrencyConversionDetails(Collection<P> priceInfos, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Always throws an UnsupportedOperationException since no currency conversion is supported.
      Specified by:
      populateCurrencyConversionDetails in interface CurrencyConversionService
      Type Parameters:
      P - an extension of PriceInfo
      Parameters:
      priceInfos - The priceInfos having the currencies to convert.
      priceInfoContext - The PriceInfoContext containing the requested currency of the cart.
      contextInfo - Context information regarding the current API request
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object