|
25 | 25 |
|
26 | 26 | import com.iluwatar.abstractdocument.domain.Car;
|
27 | 27 | import com.iluwatar.abstractdocument.domain.enums.Property;
|
28 |
| -import org.slf4j.Logger; |
29 |
| -import org.slf4j.LoggerFactory; |
30 |
| - |
31 | 28 | import java.util.List;
|
32 | 29 | import java.util.Map;
|
| 30 | +import org.slf4j.Logger; |
| 31 | +import org.slf4j.LoggerFactory; |
33 | 32 |
|
34 | 33 | /**
|
35 |
| - * The Abstract Document pattern enables handling additional, non-static |
36 |
| - * properties. This pattern uses concept of traits to enable type safety and |
37 |
| - * separate properties of different classes into set of interfaces. |
38 |
| - * <p> |
39 |
| - * <p> |
40 |
| - * In Abstract Document pattern,({@link AbstractDocument}) fully implements |
41 |
| - * {@link Document}) interface. Traits are then defined to enable access to |
42 |
| - * properties in usual, static way. |
| 34 | + * The Abstract Document pattern enables handling additional, non-static properties. This pattern |
| 35 | + * uses concept of traits to enable type safety and separate properties of different classes into |
| 36 | + * set of interfaces. |
| 37 | + * |
| 38 | + * <p>In Abstract Document pattern,({@link AbstractDocument}) fully implements {@link Document}) |
| 39 | + * interface. Traits are then defined to enable access to properties in usual, static way. |
43 | 40 | */
|
44 | 41 | public class App {
|
45 | 42 |
|
46 | 43 | private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
47 | 44 |
|
48 | 45 | /**
|
49 |
| - * Executes the App |
| 46 | + * Executes the App. |
50 | 47 | */
|
51 | 48 | public App() {
|
52 | 49 | LOGGER.info("Constructing parts and car");
|
53 | 50 |
|
54 | 51 | var wheelProperties = Map.of(
|
55 |
| - Property.TYPE.toString(), "wheel", |
56 |
| - Property.MODEL.toString(), "15C", |
57 |
| - Property.PRICE.toString(), 100L); |
| 52 | + Property.TYPE.toString(), "wheel", |
| 53 | + Property.MODEL.toString(), "15C", |
| 54 | + Property.PRICE.toString(), 100L); |
58 | 55 |
|
59 | 56 | var doorProperties = Map.of(
|
60 |
| - Property.TYPE.toString(), "door", |
61 |
| - Property.MODEL.toString(), "Lambo", |
62 |
| - Property.PRICE.toString(), 300L); |
| 57 | + Property.TYPE.toString(), "door", |
| 58 | + Property.MODEL.toString(), "Lambo", |
| 59 | + Property.PRICE.toString(), 300L); |
63 | 60 |
|
64 | 61 | var carProperties = Map.of(
|
65 |
| - Property.MODEL.toString(), "300SL", |
66 |
| - Property.PRICE.toString(), 10000L, |
67 |
| - Property.PARTS.toString(), List.of(wheelProperties, doorProperties)); |
| 62 | + Property.MODEL.toString(), "300SL", |
| 63 | + Property.PRICE.toString(), 10000L, |
| 64 | + Property.PARTS.toString(), List.of(wheelProperties, doorProperties)); |
68 | 65 |
|
69 | 66 | var car = new Car(carProperties);
|
70 | 67 |
|
71 | 68 | LOGGER.info("Here is our car:");
|
72 | 69 | LOGGER.info("-> model: {}", car.getModel().get());
|
73 | 70 | LOGGER.info("-> price: {}", car.getPrice().get());
|
74 | 71 | LOGGER.info("-> parts: ");
|
75 |
| - car.getParts().forEach(p -> LOGGER.info("\t{}/{}/{}", p.getType().get(), p.getModel().get(), p.getPrice().get())); |
| 72 | + car.getParts().forEach(p -> LOGGER |
| 73 | + .info("\t{}/{}/{}", p.getType().get(), p.getModel().get(), p.getPrice().get())); |
76 | 74 | }
|
77 | 75 |
|
78 | 76 | /**
|
79 |
| - * Program entry point |
| 77 | + * Program entry point. |
80 | 78 | *
|
81 | 79 | * @param args command line args
|
82 | 80 | */
|
|
0 commit comments