Skip to content

Commit 7521a8b

Browse files
authored
Merge branch 'master' into feature/3230
2 parents c09210b + d823283 commit 7521a8b

File tree

1,883 files changed

+15916
-17721
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,883 files changed

+15916
-17721
lines changed

.all-contributorsrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3466,6 +3466,24 @@
34663466
"contributions": [
34673467
"code"
34683468
]
3469+
},
3470+
{
3471+
"login": "sanurah",
3472+
"name": "Sanura Hettiarachchi",
3473+
"avatar_url": "https://avatars.githubusercontent.com/u/16178588?v=4",
3474+
"profile": "https://github.com/sanurah",
3475+
"contributions": [
3476+
"code"
3477+
]
3478+
},
3479+
{
3480+
"login": "2897robo",
3481+
"name": "Kim Gi Uk",
3482+
"avatar_url": "https://avatars.githubusercontent.com/u/31699375?v=4",
3483+
"profile": "https://github.com/2897robo",
3484+
"contributions": [
3485+
"code"
3486+
]
34693487
}
34703488
],
34713489
"contributorsPerLine": 6,

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
77
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
88
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
9-
[![All Contributors](https://img.shields.io/badge/all_contributors-380-orange.svg?style=flat-square)](#contributors-)
9+
[![All Contributors](https://img.shields.io/badge/all_contributors-382-orange.svg?style=flat-square)](#contributors-)
1010
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1111

1212
<br/>
@@ -567,6 +567,8 @@ This project is licensed under the terms of the MIT license.
567567
<tr>
568568
<td align="center" valign="top" width="16.66%"><a href="https://github.com/DenizAltunkapan"><img src="https://avatars.githubusercontent.com/u/93663085?v=4?s=100" width="100px;" alt="Deniz Altunkapan"/><br /><sub><b>Deniz Altunkapan</b></sub></a><br /><a href="#translation-DenizAltunkapan" title="Translation">🌍</a></td>
569569
<td align="center" valign="top" width="16.66%"><a href="https://github.com/johnklint81"><img src="https://avatars.githubusercontent.com/u/70539458?v=4?s=100" width="100px;" alt="John Klint"/><br /><sub><b>John Klint</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=johnklint81" title="Code">💻</a></td>
570+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/sanurah"><img src="https://avatars.githubusercontent.com/u/16178588?v=4?s=100" width="100px;" alt="Sanura Hettiarachchi"/><br /><sub><b>Sanura Hettiarachchi</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=sanurah" title="Code">💻</a></td>
571+
<td align="center" valign="top" width="16.66%"><a href="https://github.com/2897robo"><img src="https://avatars.githubusercontent.com/u/31699375?v=4?s=100" width="100px;" alt="Kim Gi Uk"/><br /><sub><b>Kim Gi Uk</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=2897robo" title="Code">💻</a></td>
570572
</tr>
571573
</tbody>
572574
</table>

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
}

0 commit comments

Comments
 (0)