Class PriceFunctionBuilder
- All Implemented Interfaces:
Builder<PriceFunction>
Example to create an instance using the builder pattern
PriceFunction priceFunction = PriceFunction.builder()
.currencyCode("{currencyCode}")
.function("{function}")
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()builds PriceFunction with checking for non-null required valuesbuilds PriceFunction without checking for non-null required valuescurrencyCode(String currencyCode) Currency code compliant to ISO 4217.To calculate a Price based on the score, use+,-,*and parentheses.Currency code compliant to ISO 4217.To calculate a Price based on the score, use+,-,*and parentheses.static PriceFunctionBuilderof()factory method for an instance of PriceFunctionBuilderstatic PriceFunctionBuilderof(PriceFunction template) create builder for PriceFunction instance
-
Constructor Details
-
PriceFunctionBuilder
public PriceFunctionBuilder()
-
-
Method Details
-
currencyCode
Currency code compliant to ISO 4217.
- Parameters:
currencyCode- value to be set- Returns:
- Builder
-
function
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 of3and 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- Returns:
- Builder
-
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 of3and 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
-
build
builds PriceFunction with checking for non-null required values- Specified by:
buildin interfaceBuilder<PriceFunction>- Returns:
- PriceFunction
-
buildUnchecked
builds PriceFunction without checking for non-null required values- Returns:
- PriceFunction
-
of
factory method for an instance of PriceFunctionBuilder- Returns:
- builder
-
of
create builder for PriceFunction instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-