Package de.hybris.platform.core
Class CoreAlgorithms
- java.lang.Object
-
- de.hybris.platform.core.CoreAlgorithms
-
public class CoreAlgorithms extends java.lang.ObjectThis 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 Modifier and Type Class Description static interfaceCoreAlgorithms.LegacyRoundingConfigProvider
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCFG_LEGACY_ROUNDING
-
Constructor Summary
Constructors Constructor Description CoreAlgorithms()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleconvert(double sourceFactor, double targetFactor, double value)Used to converts a numeric price value from one currency to another.static doubleround(double value, int digits)Rounds a double value to the specified digits.static CoreAlgorithms.LegacyRoundingConfigProvidersetLegacyConfigProvider(CoreAlgorithms.LegacyRoundingConfigProvider provider)
-
-
-
Field Detail
-
CFG_LEGACY_ROUNDING
public static final java.lang.String CFG_LEGACY_ROUNDING
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
-
-