Interface PriceFunction


public interface PriceFunction
PriceFunction
Example to create an instance using the builder pattern

     PriceFunction priceFunction = PriceFunction.builder()
             .currencyCode("{currencyCode}")
             .function("{function}")
             .build()
 
  • Method Details

    • getCurrencyCode

      @NotNull @NotNull String getCurrencyCode()

      Currency code compliant to ISO 4217.

      Returns:
      currencyCode
    • getFunction

      @NotNull @NotNull String getFunction()

      To calculate a Price based on the score, use +, -, * and parentheses. The score is inserted with x. The function returns the cent amount.

      For example, to charge $1.99 for a score of 1, $3.99 for a score of 2, $5.99 for a score of 3 and onwards, the function is: (200 * x) - 1). To charge $4.50, $6.00, and $7.50 for express shipping, the function is: (150 * x) + 300.

      Returns:
      function
    • setCurrencyCode

      void setCurrencyCode(String currencyCode)

      Currency code compliant to ISO 4217.

      Parameters:
      currencyCode - value to be set
    • setFunction

      void setFunction(String function)

      To calculate a Price based on the score, use +, -, * and parentheses. The score is inserted with x. The function returns the cent amount.

      For example, to charge $1.99 for a score of 1, $3.99 for a score of 2, $5.99 for a score of 3 and onwards, the function is: (200 * x) - 1). To charge $4.50, $6.00, and $7.50 for express shipping, the function is: (150 * x) + 300.

      Parameters:
      function - value to be set
    • of

      static PriceFunction of()
      factory method
      Returns:
      instance of PriceFunction
    • of

      static PriceFunction of(PriceFunction template)
      factory method to create a shallow copy PriceFunction
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      @Nullable static PriceFunction deepCopy(@Nullable PriceFunction template)
      factory method to create a deep copy of PriceFunction
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static PriceFunctionBuilder builder()
      builder factory method for PriceFunction
      Returns:
      builder
    • builder

      static PriceFunctionBuilder builder(PriceFunction template)
      create builder for PriceFunction instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withPriceFunction

      default <T> T withPriceFunction(Function<PriceFunction,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<PriceFunction> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference