package pl.koszela.jan.persistence.dto.impl;

import java.util.ArrayList;
import java.util.List;
import pl.koszela.jan.domain.Product;
import pl.koszela.jan.persistence.dto.ProductDTO;

/**
 * Created on 11.08.2017.
 *
 * @author Jan Koszela
 */
public class DefaultProductMapper {

  public static ProductDTO map(Product product) {
    DefaultProductDTO dto =  new DefaultProductDTO();
    dto.setId(product.getId());
    dto.setItem(product.getItem());
    dto.setUnitPrice(product.getUnitPrice());
    dto.setCurrency(product.getCurrency());
    dto.setMultipricing(product.isMultipricing());

    return dto;
  }

  public static List<ProductDTO> map(List<Product> products) {
    List<ProductDTO> dtos = new ArrayList<ProductDTO>();

    for (Product product : products) {
      dtos.add(map(product));
    }

    return dtos;
  }

}

@@ -119,16 +119,21 @@
 .domain.
+impl.
 Product;
@@ -616,16 +616,288 @@
 o;%0A  %7D%0A%0A
+  public static Product map(ProductDTO dto) %7B%0A    return Product.builder()%0A        .id(dto.getId())%0A        .item(dto.getItem())%0A        .unitPrice(dto.getUnitPrice())%0A        .currency(dto.getCurrency())%0A        .multipricing(dto.isMultipricing())%0A        .build();%0A  %7D%0A%0A
   public

Add map method