X Tutup
Skip to content

Commit 981c5b3

Browse files
committed
iluwatar#84 Added DTOs
1 parent 8c48d9a commit 981c5b3

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

layers/src/main/java/com/iluwatar/layers/CakeBakingService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
public interface CakeBakingService {
44

5-
void bakeNewCake(String topping, String layer1, String layer2, String layer3);
5+
void bakeNewCake(CakeInfo cakeInfo);
66

7-
void addNewTopping(CakeTopping topping);
7+
void saveNewTopping(CakeToppingInfo toppingInfo);
88

9-
void addNewLayer(CakeLayer layer);
9+
void saveNewLayer(CakeLayerInfo layerInfo);
1010
}

layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
33
public class CakeBakingServiceImpl implements CakeBakingService {
44

55
@Override
6-
public void bakeNewCake(String topping, String layer1, String layer2, String layer3) {
6+
public void bakeNewCake(CakeInfo cakeInfo) {
77
}
88

99
@Override
10-
public void addNewTopping(CakeTopping topping) {
11-
// TODO Auto-generated method stub
12-
10+
public void saveNewTopping(CakeToppingInfo toppingInfo) {
1311
}
1412

1513
@Override
16-
public void addNewLayer(CakeLayer layer) {
17-
// TODO Auto-generated method stub
18-
14+
public void saveNewLayer(CakeLayerInfo layerInfo) {
1915
}
2016
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
package com.iluwatar.layers;
22

3+
import java.util.List;
4+
35
public class CakeInfo {
46

7+
public final CakeToppingInfo cakeToppingInfo;
8+
public final List<CakeLayerInfo> cakeLayerInfos;
9+
10+
public CakeInfo(CakeToppingInfo cakeToppingInfo, List<CakeLayerInfo> cakeLayerInfos) {
11+
this.cakeToppingInfo = cakeToppingInfo;
12+
this.cakeLayerInfos = cakeLayerInfos;
13+
}
514
}

layers/src/main/java/com/iluwatar/layers/CakeLayerInfo.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@
22

33
public class CakeLayerInfo {
44

5+
public final String name;
6+
public final int calories;
7+
8+
public CakeLayerInfo(String name, int calories) {
9+
this.name = name;
10+
this.calories = calories;
11+
}
512
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package com.iluwatar.layers;
22

33
public class CakeToppingInfo {
4+
5+
public final String name;
6+
public final int calories;
47

8+
public CakeToppingInfo(String name, int calories) {
9+
this.name = name;
10+
this.calories = calories;
11+
}
512
}

0 commit comments

Comments
 (0)
X Tutup