Class CoreAlgorithms


  • public class CoreAlgorithms
    extends java.lang.Object
    This class provides miscellaneous functions used in all hybris platform layers. By now these are just price rounding and price conversion .
    • Field Detail

      • CFG_LEGACY_ROUNDING

        public static final java.lang.String CFG_LEGACY_ROUNDING
        See Also:
        Constant Field Values
    • Constructor Detail

      • CoreAlgorithms

        public CoreAlgorithms()
    • Method Detail

      • 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 with round(double, int) to achieve this.
        Parameters:
        sourceFactor - the conversionFactor of the source currency
        targetFactor - the conversionFactor of the target currency
        value - the source value
        Returns:
         value * targetFactor / sourceFactor