Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.
This commit is contained in:
abstract-factory/src/main/java/com/iluwatar/abstractfactory
async-method-invocation/src
main
java
com
iluwatar
async
method
test
java
com
iluwatar
async
method
invocation
builder/src/main/java/com/iluwatar/builder
business-delegate/src/main/java/com/iluwatar/business/delegate
caching/src
main
java
test
java
com
iluwatar
caching
callback/src/main/java/com/iluwatar/callback
chain/src/main/java/com/iluwatar/chain
checkstyle.xmlcommand/src/main/java/com/iluwatar/command
composite/src/main/java/com/iluwatar/composite
dao/src/main
double-checked-locking/src
main
java
com
iluwatar
doublechecked
locking
test
java
com
iluwatar
doublechecked
locking
double-dispatch/src
main
java
com
iluwatar
doubledispatch
test
java
com
iluwatar
doubledispatch
event-aggregator/src/test/java/com/iluwatar/event/aggregator
execute-around/src
main
java
com
iluwatar
execute
test
java
com
iluwatar
execute
facade/src/main/java/com/iluwatar/facade
fluentinterface/src
main
java
com
iluwatar
fluentinterface
test
java
com
iluwatar
fluentinterface
fluentiterable
flux/src/main/java/com/iluwatar/flux/dispatcher
flyweight/src/main/java/com/iluwatar/flyweight
front-controller/src
main
java
test
java
com
iluwatar
front
half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync
intercepting-filter/src
main
java
com
iluwatar
test
java
com
iluwatar
intercepting
filter
interpreter/src
iterator/src
main
java
com
iluwatar
test
java
com
iluwatar
iterator
layers/src/main
java
resources
lazy-loading/src/main/java/com/iluwatar/lazy/loading
memento/src/main/java/com/iluwatar/memento
message-channel/src/main/java/com/iluwatar/message/channel
model-view-presenter/src
main
java
com
iluwatar
model
test
java
com
iluwatar
model
view
presenter
monostate/src/main/java/com/iluwatar/monostate
naked-objects
dom
src
main
java
domainapp
dom
fixture
src
main
java
domainapp
fixture
integtests
src
test
java
domainapp
integtests
bootstrap
specglue
modules
simple
tests
webapp
src
main
java
domainapp
webapp
null-object/src/main/java/com/iluwatar/nullobject
object-pool/src/main/java/com/iluwatar/object/pool
observer/src/main/java/com/iluwatar/observer
poison-pill/src/main/java/com/iluwatar/poison/pill
pom.xmlprivate-class-data/src/main/java/com/iluwatar/privateclassdata
producer-consumer/src/main/java/com/iluwatar/producer/consumer
property/src/main/java/com/iluwatar/property
prototype/src/main/java/com/iluwatar/prototype
proxy/src/main/java/com/iluwatar/proxy
publish-subscribe/src/main/java/com/iluwatar/publish/subscribe
reactor/src/main/java/com/iluwatar/reactor
repository/src
main
java
com
iluwatar
resources
test
java
com
iluwatar
resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization
servant/src/main/java/com/iluwatar/servant
service-layer/src/main/java/com/iluwatar/servicelayer
app
common
hibernate
magic
spell
spellbook
wizard
service-locator/src/main/java/com/iluwatar/servicelocator
singleton/src
main
java
test
java
com
iluwatar
specification/src/main/java/com/iluwatar/specification
state/src/main/java/com/iluwatar/state
step-builder/src/main/java/com/iluwatar/stepbuilder
template-method/src/main/java/com/iluwatar/templatemethod
tolerant-reader/src/main/java/com/iluwatar/tolerantreader
twin/src/main/java/com/iluwatar/twin
visitor/src/main/java/com/iluwatar/visitor
@@ -1,20 +1,18 @@
|
||||
package com.iluwatar.abstractfactory;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* The Abstract Factory pattern provides a way to encapsulate a group of individual factories that
|
||||
* have a common theme without specifying their concrete classes. In normal usage, the client
|
||||
* software creates a concrete implementation of the abstract factory and then uses the generic
|
||||
* interface of the factory to create the concrete objects that are part of the theme. The client
|
||||
* does not know (or care) which concrete objects it gets from each of these internal factories,
|
||||
* since it uses only the generic interfaces of their products. This pattern separates the details
|
||||
* of implementation of a set of objects from their general usage and relies on object composition,
|
||||
* as object creation is implemented in methods exposed in the factory interface.
|
||||
* The Abstract Factory pattern provides a way to encapsulate a group of individual factories that have a common theme
|
||||
* without specifying their concrete classes. In normal usage, the client software creates a concrete implementation of
|
||||
* the abstract factory and then uses the generic interface of the factory to create the concrete objects that are part
|
||||
* of the theme. The client does not know (or care) which concrete objects it gets from each of these internal
|
||||
* factories, since it uses only the generic interfaces of their products. This pattern separates the details of
|
||||
* implementation of a set of objects from their general usage and relies on object composition, as object creation is
|
||||
* implemented in methods exposed in the factory interface.
|
||||
* <p>
|
||||
* The essence of the Abstract Factory pattern is a factory interface ({@link KingdomFactory}) and
|
||||
* its implementations ({@link ElfKingdomFactory}, {@link OrcKingdomFactory}). The example uses both
|
||||
* concrete implementations to create a king, a castle and an army.
|
||||
* The essence of the Abstract Factory pattern is a factory interface ({@link KingdomFactory}) and its implementations (
|
||||
* {@link ElfKingdomFactory}, {@link OrcKingdomFactory}). The example uses both concrete implementations to create a
|
||||
* king, a castle and an army.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
@@ -23,11 +21,8 @@ public class App {
|
||||
private Castle castle;
|
||||
private Army army;
|
||||
|
||||
|
||||
/**
|
||||
* Creates kingdom
|
||||
*
|
||||
* @param factory
|
||||
*/
|
||||
public void createKingdom(final KingdomFactory factory) {
|
||||
setKing(factory.createKing());
|
||||
@@ -47,14 +42,6 @@ public class App {
|
||||
return factory.createKing();
|
||||
}
|
||||
|
||||
Castle getCastle(final KingdomFactory factory) {
|
||||
return factory.createCastle();
|
||||
}
|
||||
|
||||
Army getArmy(final KingdomFactory factory) {
|
||||
return factory.createArmy();
|
||||
}
|
||||
|
||||
public King getKing() {
|
||||
return king;
|
||||
}
|
||||
@@ -62,6 +49,10 @@ public class App {
|
||||
private void setKing(final King king) {
|
||||
this.king = king;
|
||||
}
|
||||
|
||||
Castle getCastle(final KingdomFactory factory) {
|
||||
return factory.createCastle();
|
||||
}
|
||||
|
||||
public Castle getCastle() {
|
||||
return castle;
|
||||
@@ -70,6 +61,10 @@ public class App {
|
||||
private void setCastle(final Castle castle) {
|
||||
this.castle = castle;
|
||||
}
|
||||
|
||||
Army getArmy(final KingdomFactory factory) {
|
||||
return factory.createArmy();
|
||||
}
|
||||
|
||||
public Army getArmy() {
|
||||
return army;
|
||||
@@ -79,32 +74,32 @@ public class App {
|
||||
this.army = army;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
*
|
||||
* @param args command line args
|
||||
* @param args
|
||||
* command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
App app = new App();
|
||||
|
||||
System.out.println("Elf Kingdom");
|
||||
KingdomFactory elfKingdomFactory;
|
||||
elfKingdomFactory = app.getElfKingdomFactory();
|
||||
app.createKingdom(elfKingdomFactory);
|
||||
System.out.println(app.getArmy().getDescription());
|
||||
System.out.println(app.getCastle().getDescription());
|
||||
System.out.println(app.getKing().getDescription());
|
||||
|
||||
System.out.println("\nOrc Kingdom");
|
||||
KingdomFactory orcKingdomFactory;
|
||||
orcKingdomFactory = app.getOrcKingdomFactory();
|
||||
app.createKingdom(orcKingdomFactory);
|
||||
System.out.println(app.getArmy().getDescription());
|
||||
System.out.println(app.getCastle().getDescription());
|
||||
System.out.println(app.getKing().getDescription());
|
||||
|
||||
|
||||
App app = new App();
|
||||
|
||||
System.out.println("Elf Kingdom");
|
||||
KingdomFactory elfKingdomFactory;
|
||||
elfKingdomFactory = app.getElfKingdomFactory();
|
||||
app.createKingdom(elfKingdomFactory);
|
||||
System.out.println(app.getArmy().getDescription());
|
||||
System.out.println(app.getCastle().getDescription());
|
||||
System.out.println(app.getKing().getDescription());
|
||||
|
||||
System.out.println("\nOrc Kingdom");
|
||||
KingdomFactory orcKingdomFactory;
|
||||
orcKingdomFactory = app.getOrcKingdomFactory();
|
||||
app.createKingdom(orcKingdomFactory);
|
||||
System.out.println(app.getArmy().getDescription());
|
||||
System.out.println(app.getCastle().getDescription());
|
||||
System.out.println(app.getKing().getDescription());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user