Skip to content

Commit abcc398

Browse files
Evan Sia Wai SuanEvan Sia Wai Suan
authored andcommitted
Merged with upstream
2 parents 55bbb88 + 4ac6f90 commit abcc398

File tree

209 files changed

+1995
-286
lines changed

Some content is hidden

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

209 files changed

+1995
-286
lines changed

CODE_COVERAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Code Coverage Report generation
22

33
To generate the code coverage report, execute the following command:
4-
> mvn clean verify
4+
> mvn clean verify jacoco:report
55
66
This will generate code coverage report in each of the modules. In order to view the same, open the following file in your browser.
77
> target/site/jacoco/index.html

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Build status](https://travis-ci.org/iluwatar/java-design-patterns.svg?branch=master)](https://travis-ci.org/iluwatar/java-design-patterns)
88
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/LICENSE.md)
99
[![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)
10-
[![Quality Gate](https://sonarcloud.io/api/badges/gate?key=com.iluwatar%3Ajava-design-patterns)](https://sonarcloud.io/dashboard/index/com.iluwatar%3Ajava-design-patterns)
10+
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=com.iluwatar%3Ajava-design-patterns&metric=alert_status)](https://sonarcloud.io/dashboard/index/com.iluwatar%3Ajava-design-patterns)
1111
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1503/badge)](https://bestpractices.coreinfrastructure.org/projects/1503)
1212

1313
# Introduction

abstract-document/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<parent>
3030
<artifactId>java-design-patterns</artifactId>
3131
<groupId>com.iluwatar</groupId>
32-
<version>1.19.0-SNAPSHOT</version>
32+
<version>1.20.0-SNAPSHOT</version>
3333
</parent>
3434
<artifactId>abstract-document</artifactId>
3535
<dependencies>

abstract-factory/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Wikipedia says
3434

3535
Translating the kingdom example above. First of all we have some interfaces and implementation for the objects in the kingdom
3636

37-
```
37+
```java
3838
public interface Castle {
3939
String getDescription();
4040
}
@@ -74,7 +74,7 @@ public class ElfArmy implements Army {
7474

7575
Then we have the abstraction and implementations for the kingdom factory
7676

77-
```
77+
```java
7878
public interface KingdomFactory {
7979
Castle createCastle();
8080
King createKing();
@@ -108,7 +108,7 @@ public class OrcKingdomFactory implements KingdomFactory {
108108

109109
Now we have our abstract factory that lets us make family of related objects i.e. Elven kingdom factory creates Elven castle, king and army etc.
110110

111-
```
111+
```java
112112
KingdomFactory factory = new ElfKingdomFactory();
113113
Castle castle = factory.createCastle();
114114
King king = factory.createKing();
@@ -123,7 +123,7 @@ Now, we can design a factory for our different kingdom factories. In this exampl
123123
The client can use FactoryMaker to create the desired concrete factory which, in turn, will produce different concrete objects (Army, King, Castle).
124124
In this example, we also used an enum to parameterize which type of kingdom factory the client will ask for.
125125

126-
```
126+
```java
127127
public static class FactoryMaker {
128128

129129
public enum KingdomType {

abstract-factory/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<parent>
3030
<groupId>com.iluwatar</groupId>
3131
<artifactId>java-design-patterns</artifactId>
32-
<version>1.19.0-SNAPSHOT</version>
32+
<version>1.20.0-SNAPSHOT</version>
3333
</parent>
3434
<artifactId>abstract-factory</artifactId>
3535
<dependencies>

adapter/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Consider a captain that can only use rowing boats and cannot sail at all.
4040

4141
First we have interfaces `RowingBoat` and `FishingBoat`
4242

43-
```
43+
```java
4444
public interface RowingBoat {
4545
void row();
4646
}
@@ -55,7 +55,7 @@ public class FishingBoat {
5555

5656
And captain expects an implementation of `RowingBoat` interface to be able to move
5757

58-
```
58+
```java
5959
public class Captain implements RowingBoat {
6060

6161
private RowingBoat rowingBoat;
@@ -73,7 +73,7 @@ public class Captain implements RowingBoat {
7373

7474
Now let's say the pirates are coming and our captain needs to escape but there is only fishing boat available. We need to create an adapter that allows the captain to operate the fishing boat with his rowing boat skills.
7575

76-
```
76+
```java
7777
public class FishingBoatAdapter implements RowingBoat {
7878

7979
private static final Logger LOGGER = LoggerFactory.getLogger(FishingBoatAdapter.class);
@@ -93,7 +93,7 @@ public class FishingBoatAdapter implements RowingBoat {
9393

9494
And now the `Captain` can use the `FishingBoat` to escape the pirates.
9595

96-
```
96+
```java
9797
Captain captain = new Captain(new FishingBoatAdapter());
9898
captain.row();
9999
```

adapter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<parent>
3030
<groupId>com.iluwatar</groupId>
3131
<artifactId>java-design-patterns</artifactId>
32-
<version>1.19.0-SNAPSHOT</version>
32+
<version>1.20.0-SNAPSHOT</version>
3333
</parent>
3434
<artifactId>adapter</artifactId>
3535
<dependencies>

adapter/src/main/java/com/iluwatar/adapter/Captain.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* The Captain uses {@link RowingBoat} to sail. <br>
2727
* This is the client in the pattern.
2828
*/
29-
public class Captain implements RowingBoat {
29+
public class Captain {
3030

3131
private RowingBoat rowingBoat;
3232

@@ -40,7 +40,6 @@ public void setRowingBoat(RowingBoat rowingBoat) {
4040
this.rowingBoat = rowingBoat;
4141
}
4242

43-
@Override
4443
public void row() {
4544
rowingBoat.row();
4645
}

adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void setup() {
6666
*/
6767
@Test
6868
public void testAdapter() {
69-
RowingBoat captain = (RowingBoat) beans.get(ROWING_BEAN);
69+
Captain captain = (Captain) beans.get(ROWING_BEAN);
7070

7171
// when captain moves
7272
captain.row();

aggregator-microservices/aggregator-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<parent>
3030
<artifactId>aggregator-microservices</artifactId>
3131
<groupId>com.iluwatar</groupId>
32-
<version>1.19.0-SNAPSHOT</version>
32+
<version>1.20.0-SNAPSHOT</version>
3333
</parent>
3434
<modelVersion>4.0.0</modelVersion>
3535

0 commit comments

Comments
 (0)