Interface WeightCalculationService

  • All Known Implementing Classes:
    DefaultWeightCalculationService

    public interface WeightCalculationService
    Handles weight calculations for shipping pricing.
    Author:
    Cade Rea (cade-rea)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int compare​(com.broadleafcommerce.shipping.domain.Weight weight1, com.broadleafcommerce.shipping.domain.Weight weight2)
      Compare two Weights.
      com.broadleafcommerce.shipping.domain.Weight getTotalPackageWeight​(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
      Calculate the total combined weight of an OrderFulfillment.
      com.broadleafcommerce.shipping.domain.Weight getTotalPackageWeight​(com.broadleafcommerce.shipping.domain.FulfillmentPricingRequest fulfillmentPricingRequest)
      Calculate the total combined weight of a FulfillmentPricingRequest.
    • Method Detail

      • compare

        int compare​(com.broadleafcommerce.shipping.domain.Weight weight1,
                    com.broadleafcommerce.shipping.domain.Weight weight2)

        Compare two Weights. Weights can be of different units, such as comparing pounds to kilograms.

        Conceptually similar to "weight1.compareTo(weight2)". Returns -1, 0, or 1, according to whether weight1 is less than, equal to, or greater than weight2.

        Parameters:
        weight1 - The left operand weight.
        weight2 - The right operand weight.
        Returns:
        -1, 0, or 1, according to whether weight1 is less than, equal to, or greater than weight2.
        See Also:
        Comparable.compareTo(java.lang.Object)
      • getTotalPackageWeight

        com.broadleafcommerce.shipping.domain.Weight getTotalPackageWeight​(com.broadleafcommerce.shipping.domain.FulfillmentPricingRequest fulfillmentPricingRequest)
        Calculate the total combined weight of a FulfillmentPricingRequest.
        Parameters:
        fulfillmentPricingRequest - The fulfillment being shipped.
        Returns:
        A Weight representing the total weight of all items in the fulfillment.
      • getTotalPackageWeight

        com.broadleafcommerce.shipping.domain.Weight getTotalPackageWeight​(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
        Calculate the total combined weight of an OrderFulfillment.
        Parameters:
        orderFulfillment - The fulfillment being shipped.
        Returns:
        A Weight representing the total weight of all items in the fulfillment.