Skip to content

Commit 1e76d91

Browse files
anuragagarwal561994iluwatar
authored andcommitted
Resolves checkstyle errors for abstract-document abstract-factory acyclic-visitor adapter aggregator-microservices (iluwatar#1080)
* Reduces checkstyle errors in abstract-document * Reduces checkstyle errors in abstract-factory * Reduces checkstyle errors in acyclic-visitor * Reduces checkstyle errors in adapter * Reduces checkstyle errors in aggregator-microservices
1 parent 3907951 commit 1e76d91

File tree

50 files changed

+154
-211
lines changed

Some content is hidden

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

50 files changed

+154
-211
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import java.util.stream.Stream;
3232

3333
/**
34-
* Abstract implementation of Document interface
34+
* Abstract implementation of Document interface.
3535
*/
3636
public abstract class AbstractDocument implements Document {
3737

@@ -64,7 +64,8 @@ public <T> Stream<T> children(String key, Function<Map<String, Object>, T> const
6464
public String toString() {
6565
var builder = new StringBuilder();
6666
builder.append(getClass().getName()).append("[");
67-
properties.forEach((key, value) -> builder.append("[").append(key).append(" : ").append(value).append("]"));
67+
properties.forEach((key, value) -> builder.append("[").append(key).append(" : ").append(value)
68+
.append("]"));
6869
builder.append("]");
6970
return builder.toString();
7071
}

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

+21-23
Original file line numberDiff line numberDiff line change
@@ -25,58 +25,56 @@
2525

2626
import com.iluwatar.abstractdocument.domain.Car;
2727
import com.iluwatar.abstractdocument.domain.enums.Property;
28-
import org.slf4j.Logger;
29-
import org.slf4j.LoggerFactory;
30-
3128
import java.util.List;
3229
import java.util.Map;
30+
import org.slf4j.Logger;
31+
import org.slf4j.LoggerFactory;
3332

3433
/**
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.
4340
*/
4441
public class App {
4542

4643
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
4744

4845
/**
49-
* Executes the App
46+
* Executes the App.
5047
*/
5148
public App() {
5249
LOGGER.info("Constructing parts and car");
5350

5451
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);
5855

5956
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);
6360

6461
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));
6865

6966
var car = new Car(carProperties);
7067

7168
LOGGER.info("Here is our car:");
7269
LOGGER.info("-> model: {}", car.getModel().get());
7370
LOGGER.info("-> price: {}", car.getPrice().get());
7471
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()));
7674
}
7775

7876
/**
79-
* Program entry point
77+
* Program entry point.
8078
*
8179
* @param args command line args
8280
*/

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
import java.util.stream.Stream;
2929

3030
/**
31-
* Document interface
31+
* Document interface.
3232
*/
3333
public interface Document {
3434

3535
/**
36-
* Puts the value related to the key
36+
* Puts the value related to the key.
3737
*
3838
* @param key element key
3939
* @param value element value
@@ -42,15 +42,15 @@ public interface Document {
4242
Void put(String key, Object value);
4343

4444
/**
45-
* Gets the value for the key
45+
* Gets the value for the key.
4646
*
4747
* @param key element key
4848
* @return value or null
4949
*/
5050
Object get(String key);
5151

5252
/**
53-
* Gets the stream of child documents
53+
* Gets the stream of child documents.
5454
*
5555
* @param key element key
5656
* @param constructor constructor of child class

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323

2424
package com.iluwatar.abstractdocument.domain;
2525

26-
import java.util.Map;
27-
2826
import com.iluwatar.abstractdocument.AbstractDocument;
27+
import java.util.Map;
2928

3029
/**
31-
* Car entity
30+
* Car entity.
3231
*/
3332
public class Car extends AbstractDocument implements HasModel, HasPrice, HasParts {
3433

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323

2424
package com.iluwatar.abstractdocument.domain;
2525

26-
import java.util.Optional;
27-
2826
import com.iluwatar.abstractdocument.Document;
2927
import com.iluwatar.abstractdocument.domain.enums.Property;
28+
import java.util.Optional;
3029

3130
/**
32-
* HasModel trait for static access to 'model' property
31+
* HasModel trait for static access to 'model' property.
3332
*/
3433
public interface HasModel extends Document {
3534

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323

2424
package com.iluwatar.abstractdocument.domain;
2525

26-
import java.util.stream.Stream;
27-
2826
import com.iluwatar.abstractdocument.Document;
2927
import com.iluwatar.abstractdocument.domain.enums.Property;
28+
import java.util.stream.Stream;
3029

3130
/**
32-
* HasParts trait for static access to 'parts' property
31+
* HasParts trait for static access to 'parts' property.
3332
*/
3433
public interface HasParts extends Document {
3534

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323

2424
package com.iluwatar.abstractdocument.domain;
2525

26-
import java.util.Optional;
27-
2826
import com.iluwatar.abstractdocument.Document;
2927
import com.iluwatar.abstractdocument.domain.enums.Property;
28+
import java.util.Optional;
3029

3130
/**
32-
* HasPrice trait for static access to 'price' property
31+
* HasPrice trait for static access to 'price' property.
3332
*/
3433
public interface HasPrice extends Document {
3534

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323

2424
package com.iluwatar.abstractdocument.domain;
2525

26-
import java.util.Optional;
27-
2826
import com.iluwatar.abstractdocument.Document;
2927
import com.iluwatar.abstractdocument.domain.enums.Property;
28+
import java.util.Optional;
3029

3130
/**
32-
* HasType trait for static access to 'type' property
31+
* HasType trait for static access to 'type' property.
3332
*/
3433
public interface HasType extends Document {
3534

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323

2424
package com.iluwatar.abstractdocument.domain;
2525

26-
import java.util.Map;
27-
2826
import com.iluwatar.abstractdocument.AbstractDocument;
27+
import java.util.Map;
2928

3029
/**
31-
* Part entity
30+
* Part entity.
3231
*/
3332
public class Part extends AbstractDocument implements HasType, HasModel, HasPrice {
3433

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
package com.iluwatar.abstractdocument.domain.enums;
2525

2626
/**
27-
*
28-
* Enum To Describe Property type
29-
*
27+
* Enum To Describe Property type.
3028
*/
3129
public enum Property {
3230

abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java

+19-22
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,23 @@
2323

2424
package com.iluwatar.abstractfactory;
2525

26+
import com.iluwatar.abstractfactory.App.FactoryMaker.KingdomType;
2627
import org.slf4j.Logger;
2728
import org.slf4j.LoggerFactory;
2829

29-
import com.iluwatar.abstractfactory.App.FactoryMaker.KingdomType;
30-
3130
/**
32-
*
33-
* The Abstract Factory pattern provides a way to encapsulate a group of individual factories that have a common theme
34-
* without specifying their concrete classes. In normal usage, the client software creates a concrete implementation of
35-
* the abstract factory and then uses the generic interface of the factory to create the concrete objects that are part
36-
* of the theme. The client does not know (or care) which concrete objects it gets from each of these internal
37-
* factories, since it uses only the generic interfaces of their products. This pattern separates the details of
38-
* implementation of a set of objects from their general usage and relies on object composition, as object creation is
39-
* implemented in methods exposed in the factory interface.
40-
* <p>
41-
* The essence of the Abstract Factory pattern is a factory interface ({@link KingdomFactory}) and its implementations (
42-
* {@link ElfKingdomFactory}, {@link OrcKingdomFactory}). The example uses both concrete implementations to create a
43-
* king, a castle and an army.
44-
*
31+
* The Abstract Factory pattern provides a way to encapsulate a group of individual factories that
32+
* have a common theme without specifying their concrete classes. In normal usage, the client
33+
* software creates a concrete implementation of the abstract factory and then uses the generic
34+
* interface of the factory to create the concrete objects that are part of the theme. The client
35+
* does not know (or care) which concrete objects it gets from each of these internal factories,
36+
* since it uses only the generic interfaces of their products. This pattern separates the details
37+
* of implementation of a set of objects from their general usage and relies on object composition,
38+
* as object creation is implemented in methods exposed in the factory interface.
39+
*
40+
* <p>The essence of the Abstract Factory pattern is a factory interface ({@link KingdomFactory})
41+
* and its implementations ( {@link ElfKingdomFactory}, {@link OrcKingdomFactory}). The example uses
42+
* both concrete implementations to create a king, a castle and an army.
4543
*/
4644
public class App {
4745

@@ -52,14 +50,14 @@ public class App {
5250
private Army army;
5351

5452
/**
55-
* Creates kingdom
53+
* Creates kingdom.
5654
*/
5755
public void createKingdom(final KingdomFactory factory) {
5856
setKing(factory.createKing());
5957
setCastle(factory.createCastle());
6058
setArmy(factory.createArmy());
6159
}
62-
60+
6361
King getKing(final KingdomFactory factory) {
6462
return factory.createKing();
6563
}
@@ -71,7 +69,7 @@ public King getKing() {
7169
private void setKing(final King king) {
7270
this.king = king;
7371
}
74-
72+
7573
Castle getCastle(final KingdomFactory factory) {
7674
return factory.createCastle();
7775
}
@@ -83,7 +81,7 @@ public Castle getCastle() {
8381
private void setCastle(final Castle castle) {
8482
this.castle = castle;
8583
}
86-
84+
8785
Army getArmy(final KingdomFactory factory) {
8886
return factory.createArmy();
8987
}
@@ -125,9 +123,8 @@ public static KingdomFactory makeFactory(KingdomType type) {
125123

126124
/**
127125
* Program entry point.
128-
*
129-
* @param args
130-
* command line args
126+
*
127+
* @param args command line args
131128
*/
132129
public static void main(String[] args) {
133130

abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
package com.iluwatar.abstractfactory;
2525

2626
/**
27-
*
28-
* Army interface
29-
*
27+
* Army interface.
3028
*/
3129
public interface Army {
3230

abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
package com.iluwatar.abstractfactory;
2525

2626
/**
27-
*
28-
* Castle interface
29-
*
27+
* Castle interface.
3028
*/
3129
public interface Castle {
3230

abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
package com.iluwatar.abstractfactory;
2525

2626
/**
27-
*
28-
* ElfArmy
29-
*
27+
* ElfArmy.
3028
*/
3129
public class ElfArmy implements Army {
3230

abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
package com.iluwatar.abstractfactory;
2525

2626
/**
27-
*
28-
* ElfCastle
29-
*
27+
* ElfCastle.
3028
*/
3129
public class ElfCastle implements Castle {
3230

abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
package com.iluwatar.abstractfactory;
2525

2626
/**
27-
*
28-
* ElfKing
29-
*
27+
* ElfKing.
3028
*/
3129
public class ElfKing implements King {
3230

abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java

-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
package com.iluwatar.abstractfactory;
2525

2626
/**
27-
*
2827
* ElfKingdomFactory concrete factory.
29-
*
3028
*/
3129
public class ElfKingdomFactory implements KingdomFactory {
3230

abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
package com.iluwatar.abstractfactory;
2525

2626
/**
27-
*
28-
* King interface
29-
*
27+
* King interface.
3028
*/
3129
public interface King {
3230

0 commit comments

Comments
 (0)