Skip to content

Instantly share code, notes, and snippets.

@srdelarosa
Created March 20, 2021 01:43
Show Gist options
  • Save srdelarosa/7e3b40e57ec448cb5a0772c0a90e626e to your computer and use it in GitHub Desktop.
Save srdelarosa/7e3b40e57ec448cb5a0772c0a90e626e to your computer and use it in GitHub Desktop.
package com.newhorizons.takeitnow.item.application.mainmodule.mapper;
import com.newhorizons.takeitnow.item.application.mainmodule.dto.ProductDto;
import com.newhorizons.takeitnow.item.domain.entity.Product;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import java.util.List;
@Mapper(componentModel = "spring")
public interface IProductMapper {
@Mappings({
@Mapping(source = "productId", target = "sku"),
@Mapping(source = "description", target = "name")
})
ProductDto toProductDto(Product product);
List<ProductDto> toProductsDto(List<Product> products);
@InheritInverseConfiguration
Product toProduct(ProductDto productDto);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment