Created
March 19, 2021 01:30
-
-
Save srdelarosa/f66f6869358b9c6327df434ba0439f7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.newhorizons.takeitnow.products.application.mainmodule.mapper; | |
import com.newhorizons.takeitnow.products.application.mainmodule.dto.ProductDto; | |
import com.newhorizons.takeitnow.products.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 = "id", target = "productId"), | |
@Mapping(source = "description", target = "description"), | |
@Mapping(source = "price", target = "price") | |
}) | |
ProductDto toProductDto(Product product); | |
List<ProductDto> toProductsDto(List<Product> products); | |
@InheritInverseConfiguration | |
@Mappings({ | |
@Mapping(target = "createAt", ignore = true) | |
}) | |
Product toProduct(ProductDto productDto); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment