Package de.hybris.platform.core
Class CoreAlgorithms
java.lang.Object
de.hybris.platform.core.CoreAlgorithms
This class provides miscellaneous functions used in all hybris platform layers. By now these are just price
rounding and price conversion .
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
CFG_LEGACY_ROUNDING
- See Also:
-
-
Constructor Details
-
CoreAlgorithms
public CoreAlgorithms()
-
-
Method Details
-
setLegacyConfigProvider
public static CoreAlgorithms.LegacyRoundingConfigProvider setLegacyConfigProvider(CoreAlgorithms.LegacyRoundingConfigProvider provider) -
round
public static double round(double value, int digits) Rounds a double value to the specified digits.- Parameters:
value-digits-- Returns:
round(value * 10 ˆ digits) / 10 ˆ digits
-
convert
public static double convert(double sourceFactor, double targetFactor, double value) Used to converts a numeric price value from one currency to another. Please note that this method does no rounding. You can use it in connection withround(double, int)to achieve this.- Parameters:
sourceFactor- the conversionFactor of the source currencytargetFactor- the conversionFactor of the target currencyvalue- the source value- Returns:
value * targetFactor / sourceFactor
-