Class CartConverter

java.lang.Object
com.glowmart.shop_management.converter.CartConverter

public class CartConverter extends Object
A utility class that provides conversion methods between Cart and CartDto.

This class helps in transforming entity objects to DTOs and vice versa, ensuring a clean separation between database entities and data transfer objects.

  • Constructor Details

    • CartConverter

      public CartConverter()
  • Method Details

    • convertToCart

      public static Cart convertToCart(CartDto cartDto)
      Converts a CartDto object to a Cart entity.
      Parameters:
      cartDto - the CartDto object to convert
      Returns:
      a new Cart entity with values copied from the provided DTO
    • convertToCartDto

      public static CartDto convertToCartDto(Cart cart)
      Converts a Cart entity to a CartDto object.
      Parameters:
      cart - the Cart entity to convert
      Returns:
      a new CartDto object with values copied from the provided entity