public GroceryListBean createGroceryListBean(GroceryListDto groceryListDto) { GroceryListBean groceryListBean = new GroceryListBean(groceryListDto.getName()); for (ProductDto productDto : groceryListDto.getItems()) { ProductBean productBean = createProductBean(productDto); productBean.setId(productDto.getId()); productBean.setQuantity(productDto.getQuantity()); productBean.setCost(productDto.getCost()); groceryListBean.getItems().add(productBean); } return groceryListBean; }
public ProductBean createProductBean(ProductDto productDto) { ProductBean productBean = new ProductBean(); productBean.setMeasuredIn(productDto.getMeasuredIn()); productBean.setName(productDto.getName()); return productBean; }