Class MeasurementProperties

java.lang.Object
com.broadleafcommerce.shipping.service.autoconfigure.MeasurementProperties

@ConfigurationProperties("broadleaf.shipping.service.measurements") public class MeasurementProperties extends Object
  • Constructor Details

    • MeasurementProperties

      public MeasurementProperties()
  • Method Details

    • getUnitAliases

      public Map<String,List<String>> getUnitAliases()

      Map of a unit of measure to a list of aliases. The aliases should align with the weight units enabled in the admin.

      This is important when calculating the total package weight. By default, UnitFormat.parse(CharSequence) would find USCustomary.POUND from the String "lb", but not from "POUNDS". If an items weight is set in pounds in the admin, then the weight calculation would not be able to determine the unit for that value. Assigning aliases allows us to look up the unit of measure based on the admin data.

      This yaml property example would add "POUND" and "POUNDS" as aliases for USCustomary.POUND.

       broadleaf:
         shipping:
           service:
             measurements:
               unitAliases:
                 systems.uom.common.USCustomary.POUND:
                   - POUND
                   - POUNDS
       

    • getWeightPrecision

      public Integer getWeightPrecision()
      The number of significant digits to use for weight calculations. This applies to all digits of a number, before and after the decimal. This is important when units are converted during weight calculations.
    • setUnitAliases

      public void setUnitAliases(Map<String,List<String>> unitAliases)

      Map of a unit of measure to a list of aliases. The aliases should align with the weight units enabled in the admin.

      This is important when calculating the total package weight. By default, UnitFormat.parse(CharSequence) would find USCustomary.POUND from the String "lb", but not from "POUNDS". If an items weight is set in pounds in the admin, then the weight calculation would not be able to determine the unit for that value. Assigning aliases allows us to look up the unit of measure based on the admin data.

      This yaml property example would add "POUND" and "POUNDS" as aliases for USCustomary.POUND.

       broadleaf:
         shipping:
           service:
             measurements:
               unitAliases:
                 systems.uom.common.USCustomary.POUND:
                   - POUND
                   - POUNDS
       

    • setWeightPrecision

      public void setWeightPrecision(Integer weightPrecision)
      The number of significant digits to use for weight calculations. This applies to all digits of a number, before and after the decimal. This is important when units are converted during weight calculations.