diff --git a/abstract-document/README.md b/abstract-document/README.md index e5bb1889f..358e0915e 100644 --- a/abstract-document/README.md +++ b/abstract-document/README.md @@ -77,7 +77,8 @@ public abstract class AbstractDocument implements Document { .flatMap(Collection::stream) .map(constructor); } - ... + + // Other properties and methods... } ``` @@ -132,30 +133,36 @@ public class Car extends AbstractDocument implements HasModel, HasPrice, HasPart And finally here's how we construct and use the `Car` in a full example. ```java -LOGGER.info("Constructing parts and car"); + public static void main(String[] args) { + LOGGER.info("Constructing parts and car"); -var wheelProperties = Map.of( - Property.TYPE.toString(), "wheel", - Property.MODEL.toString(), "15C", - Property.PRICE.toString(), 100L); + var wheelProperties = Map.of( + Property.TYPE.toString(), "wheel", + Property.MODEL.toString(), "15C", + Property.PRICE.toString(), 100L); -var doorProperties = Map.of( - Property.TYPE.toString(), "door", - Property.MODEL.toString(), "Lambo", - Property.PRICE.toString(), 300L); + var doorProperties = Map.of( + Property.TYPE.toString(), "door", + Property.MODEL.toString(), "Lambo", + Property.PRICE.toString(), 300L); -var carProperties = Map.of( - Property.MODEL.toString(), "300SL", - Property.PRICE.toString(), 10000L, - Property.PARTS.toString(), List.of(wheelProperties, doorProperties)); + var carProperties = Map.of( + Property.MODEL.toString(), "300SL", + Property.PRICE.toString(), 10000L, + Property.PARTS.toString(), List.of(wheelProperties, doorProperties)); -var car = new Car(carProperties); + var car = new Car(carProperties); -LOGGER.info("Here is our car:"); -LOGGER.info("-> model: {}", car.getModel().orElseThrow()); -LOGGER.info("-> price: {}", car.getPrice().orElseThrow()); -LOGGER.info("-> parts: "); -car.getParts().forEach(p -> LOGGER.info("\t{}/{}/{}", p.getType().orElse(null), p.getModel().orElse(null), p.getPrice().orElse(null))); + LOGGER.info("Here is our car:"); + LOGGER.info("-> model: {}", car.getModel().orElseThrow()); + LOGGER.info("-> price: {}", car.getPrice().orElseThrow()); + LOGGER.info("-> parts: "); + car.getParts().forEach(p -> LOGGER.info("\t{}/{}/{}", + p.getType().orElse(null), + p.getModel().orElse(null), + p.getPrice().orElse(null)) + ); +} ``` The program output: