Interface PriceFunction
Example to create an instance using the builder pattern
PriceFunction priceFunction = PriceFunction.builder()
.currencyCode("{currencyCode}")
.function("{function}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic PriceFunctionBuilder
builder()
builder factory method for PriceFunctionstatic PriceFunctionBuilder
builder
(PriceFunction template) create builder for PriceFunction instancestatic PriceFunction
deepCopy
(PriceFunction template) factory method to create a deep copy of PriceFunction@NotNull String
Currency code compliant to ISO 4217.@NotNull String
To calculate a Price based on the score, use+
,-
,*
and parentheses.static PriceFunction
of()
factory methodstatic PriceFunction
of
(PriceFunction template) factory method to create a shallow copy PriceFunctionvoid
setCurrencyCode
(String currencyCode) Currency code compliant to ISO 4217.void
setFunction
(String function) To calculate a Price based on the score, use+
,-
,*
and parentheses.static com.fasterxml.jackson.core.type.TypeReference<PriceFunction>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withPriceFunction
(Function<PriceFunction, T> helper) accessor map function
-
Method Details
-
getCurrencyCode
Currency code compliant to ISO 4217.
- Returns:
- currencyCode
-
getFunction
To calculate a Price based on the score, use
+
,-
,*
and parentheses. The score is inserted withx
. The function returns the cent amount.For example, to charge $1.99 for a score of
1
, $3.99 for a score of2
, $5.99 for a score of3
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
Currency code compliant to ISO 4217.
- Parameters:
currencyCode
- value to be set
-
setFunction
To calculate a Price based on the score, use
+
,-
,*
and parentheses. The score is inserted withx
. The function returns the cent amount.For example, to charge $1.99 for a score of
1
, $3.99 for a score of2
, $5.99 for a score of3
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
factory method- Returns:
- instance of PriceFunction
-
of
factory method to create a shallow copy PriceFunction- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of PriceFunction- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for PriceFunction- Returns:
- builder
-
builder
create builder for PriceFunction instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withPriceFunction
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-