Skip to content

Commit 7fdc594

Browse files
authored
Merge branch 'master' into master
2 parents d5ac9d4 + 0ca162a commit 7fdc594

File tree

1,863 files changed

+14488
-17717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,863 files changed

+14488
-17717
lines changed

abstract-document/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
</parent>
3535
<artifactId>abstract-document</artifactId>
3636
<dependencies>
37+
<dependency>
38+
<groupId>org.slf4j</groupId>
39+
<artifactId>slf4j-api</artifactId>
40+
</dependency>
41+
<dependency>
42+
<groupId>ch.qos.logback</groupId>
43+
<artifactId>logback-classic</artifactId>
44+
</dependency>
3745
<dependency>
3846
<groupId>org.junit.jupiter</groupId>
3947
<artifactId>junit-jupiter-engine</artifactId>

abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
import java.util.function.Function;
3232
import java.util.stream.Stream;
3333

34-
/**
35-
* Abstract implementation of Document interface.
36-
*/
34+
/** Abstract implementation of Document interface. */
3735
public abstract class AbstractDocument implements Document {
3836

3937
private final Map<String, Object> documentProperties;
@@ -57,12 +55,12 @@ public Object get(String key) {
5755
@Override
5856
public <T> Stream<T> children(String key, Function<Map<String, Object>, T> childConstructor) {
5957
return Stream.ofNullable(get(key))
60-
.filter(Objects::nonNull)
61-
.map(el -> (List<Map<String, Object>>) el)
62-
.findAny()
63-
.stream()
64-
.flatMap(Collection::stream)
65-
.map(childConstructor);
58+
.filter(Objects::nonNull)
59+
.map(el -> (List<Map<String, Object>>) el)
60+
.findAny()
61+
.stream()
62+
.flatMap(Collection::stream)
63+
.map(childConstructor);
6664
}
6765

6866
@Override
@@ -100,5 +98,4 @@ private String buildStringRepresentation() {
10098
builder.append("]");
10199
return builder.toString();
102100
}
103-
104101
}

abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,40 @@ public class App {
4949
public static void main(String[] args) {
5050
LOGGER.info("Constructing parts and car");
5151

52-
var wheelProperties = Map.of(
53-
Property.TYPE.toString(), "wheel",
54-
Property.MODEL.toString(), "15C",
55-
Property.PRICE.toString(), 100L);
52+
var wheelProperties =
53+
Map.of(
54+
Property.TYPE.toString(), "wheel",
55+
Property.MODEL.toString(), "15C",
56+
Property.PRICE.toString(), 100L);
5657

57-
var doorProperties = Map.of(
58-
Property.TYPE.toString(), "door",
59-
Property.MODEL.toString(), "Lambo",
60-
Property.PRICE.toString(), 300L);
58+
var doorProperties =
59+
Map.of(
60+
Property.TYPE.toString(), "door",
61+
Property.MODEL.toString(), "Lambo",
62+
Property.PRICE.toString(), 300L);
6163

62-
var carProperties = Map.of(
63-
Property.MODEL.toString(), "300SL",
64-
Property.PRICE.toString(), 10000L,
65-
Property.PARTS.toString(), List.of(wheelProperties, doorProperties));
64+
var carProperties =
65+
Map.of(
66+
Property.MODEL.toString(),
67+
"300SL",
68+
Property.PRICE.toString(),
69+
10000L,
70+
Property.PARTS.toString(),
71+
List.of(wheelProperties, doorProperties));
6672

6773
var car = new Car(carProperties);
6874

6975
LOGGER.info("Here is our car:");
7076
LOGGER.info("-> model: {}", car.getModel().orElseThrow());
7177
LOGGER.info("-> price: {}", car.getPrice().orElseThrow());
7278
LOGGER.info("-> parts: ");
73-
car.getParts().forEach(p -> LOGGER.info("\t{}/{}/{}",
74-
p.getType().orElse(null),
75-
p.getModel().orElse(null),
76-
p.getPrice().orElse(null))
77-
);
79+
car.getParts()
80+
.forEach(
81+
p ->
82+
LOGGER.info(
83+
"\t{}/{}/{}",
84+
p.getType().orElse(null),
85+
p.getModel().orElse(null),
86+
p.getPrice().orElse(null)));
7887
}
7988
}

abstract-document/src/main/java/com/iluwatar/abstractdocument/Document.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@
2828
import java.util.function.Function;
2929
import java.util.stream.Stream;
3030

31-
/**
32-
* Document interface.
33-
*/
31+
/** Document interface. */
3432
public interface Document {
3533

3634
/**
3735
* Puts the value related to the key.
3836
*
39-
* @param key element key
37+
* @param key element key
4038
* @param value element value
4139
* @return Void
4240
*/
@@ -53,7 +51,7 @@ public interface Document {
5351
/**
5452
* Gets the stream of child documents.
5553
*
56-
* @param key element key
54+
* @param key element key
5755
* @param constructor constructor of child class
5856
* @return child documents
5957
*/

abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Car.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@
2727
import com.iluwatar.abstractdocument.AbstractDocument;
2828
import java.util.Map;
2929

30-
/**
31-
* Car entity.
32-
*/
30+
/** Car entity. */
3331
public class Car extends AbstractDocument implements HasModel, HasPrice, HasParts {
3432

3533
public Car(Map<String, Object> properties) {
3634
super(properties);
3735
}
38-
3936
}

abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import com.iluwatar.abstractdocument.domain.enums.Property;
2929
import java.util.Optional;
3030

31-
/**
32-
* HasModel trait for static access to 'model' property.
33-
*/
31+
/** HasModel trait for static access to 'model' property. */
3432
public interface HasModel extends Document {
3533

3634
default Optional<String> getModel() {
3735
return Optional.ofNullable((String) get(Property.MODEL.toString()));
3836
}
39-
4037
}

abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import com.iluwatar.abstractdocument.domain.enums.Property;
2929
import java.util.stream.Stream;
3030

31-
/**
32-
* HasParts trait for static access to 'parts' property.
33-
*/
31+
/** HasParts trait for static access to 'parts' property. */
3432
public interface HasParts extends Document {
3533

3634
default Stream<Part> getParts() {
3735
return children(Property.PARTS.toString(), Part::new);
3836
}
39-
4037
}

abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import com.iluwatar.abstractdocument.domain.enums.Property;
2929
import java.util.Optional;
3030

31-
/**
32-
* HasPrice trait for static access to 'price' property.
33-
*/
31+
/** HasPrice trait for static access to 'price' property. */
3432
public interface HasPrice extends Document {
3533

3634
default Optional<Number> getPrice() {
3735
return Optional.ofNullable((Number) get(Property.PRICE.toString()));
3836
}
39-
4037
}

abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import com.iluwatar.abstractdocument.domain.enums.Property;
2929
import java.util.Optional;
3030

31-
/**
32-
* HasType trait for static access to 'type' property.
33-
*/
31+
/** HasType trait for static access to 'type' property. */
3432
public interface HasType extends Document {
3533

3634
default Optional<String> getType() {
3735
return Optional.ofNullable((String) get(Property.TYPE.toString()));
3836
}
39-
4037
}

abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Part.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@
2727
import com.iluwatar.abstractdocument.AbstractDocument;
2828
import java.util.Map;
2929

30-
/**
31-
* Part entity.
32-
*/
30+
/** Part entity. */
3331
public class Part extends AbstractDocument implements HasType, HasModel, HasPrice {
3432

3533
public Part(Map<String, Object> properties) {
3634
super(properties);
3735
}
38-
3936
}

0 commit comments

Comments
 (0)