Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b3e4e8a
Work on #226, #213, added references of Gang Of Four to all GoF patte…
npathai Sep 22, 2015
ec9af41
#247 adding getAttackPower method to pattern decorator
mgalushka Sep 23, 2015
6735c81
Merge pull request #253 from mgalushka/master
iluwatar Sep 23, 2015
3680953
checkstyle fixes - docs, indent etc
zafarella Sep 24, 2015
ba6511f
Work on #226, moved POSA reference and some J2EE design pattern refer…
npathai Sep 24, 2015
60f9b71
eliminate all warnings of checkstyle.
zafarella Sep 24, 2015
c1fda3a
Merge pull request #254 from zafarella/refactor-singleton-according-t…
iluwatar Sep 24, 2015
e077aa3
Travis deploy web site to S3
iluwatar Sep 26, 2015
2ad361f
Travis configuration changes #255
iluwatar Sep 26, 2015
793b1cc
Travis configuration changes #255
iluwatar Sep 26, 2015
83fed6d
Fix Travis config syntax #255
iluwatar Sep 26, 2015
621c349
Remove broken deploy config #255
iluwatar Sep 26, 2015
11cdd20
Update version to 1.7.0
iluwatar Sep 30, 2015
6413c4d
Added more Singleton documentation #188
iluwatar Oct 2, 2015
0a61d7b
Improve Abstract Factory Javadocs
iluwatar Oct 3, 2015
8c6caa2
Improve Adapter Javadoc
iluwatar Oct 3, 2015
cdd586e
Improve Bridge Javadoc
iluwatar Oct 3, 2015
9a08e35
Improve Builder Javadoc
iluwatar Oct 3, 2015
a2f3d58
Improve Chain Javadoc
iluwatar Oct 3, 2015
d5f52ed
Improve Command Javadoc
iluwatar Oct 3, 2015
807478a
Improve Composite Javadoc
iluwatar Oct 3, 2015
621793e
Improved DAO Javadoc
iluwatar Oct 3, 2015
8cf35fc
Improve Decorator Javadoc
iluwatar Oct 3, 2015
e32b440
Improve Double Checked Locking Javadoc
iluwatar Oct 3, 2015
584a222
Improve Event Aggregator Javadoc
iluwatar Oct 3, 2015
516b127
Improved Facade Javadoc
iluwatar Oct 3, 2015
c989f6c
Improve Factory Method Javadoc
iluwatar Oct 3, 2015
c27291f
Improve Fluent Interface Javadoc
iluwatar Oct 3, 2015
b4118bb
Improve Intercepting Filter Javadoc
iluwatar Oct 3, 2015
44d7be9
Improve Interpreter Javadoc
iluwatar Oct 3, 2015
e4ff39e
Improve Iterator Javadoc
iluwatar Oct 3, 2015
fc66ae8
Improve Mediator Javadoc
iluwatar Oct 3, 2015
ca6bb7a
Improve Memento Javadoc
iluwatar Oct 3, 2015
4d1aae2
Improve Observer Javadoc
iluwatar Oct 3, 2015
98aa28d
Improve Poison Pill Javadoc
iluwatar Oct 3, 2015
40e378c
Improve Property Javadoc
iluwatar Oct 3, 2015
9a4f83e
Improve Prototype Javadoc
iluwatar Oct 3, 2015
c3a827b
Improved Proxy Javadoc
iluwatar Oct 3, 2015
8db2bb2
Improve Servant Javadoc
iluwatar Oct 3, 2015
74e3225
Improve Service Locator Javadoc
iluwatar Oct 3, 2015
2234a25
Improve State Javadoc
iluwatar Oct 3, 2015
0a9879a
Improve Strategy Javadoc
iluwatar Oct 3, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
language: java

jdk:
- oraclejdk8
- oraclejdk8

env:
global:
- GH_REF: github.com/iluwatar/java-design-patterns.git
- secure: "LxTDuNS/rBWIvKkaEqr79ImZAe48mCdoYCF41coxNXgNoippo4GIBArknqtv+XvdkiuRZ1yGyj6pn8GU33c/yn+krddTUkVCwTbVatbalW5jhQjDbHYym/JcxaK9ZS/3JTeGcWrBgiPqHEEDhCf26vPZsXoMSeVCEORVKTp1BSg="

before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- secure: LxTDuNS/rBWIvKkaEqr79ImZAe48mCdoYCF41coxNXgNoippo4GIBArknqtv+XvdkiuRZ1yGyj6pn8GU33c/yn+krddTUkVCwTbVatbalW5jhQjDbHYym/JcxaK9ZS/3JTeGcWrBgiPqHEEDhCf26vPZsXoMSeVCEORVKTp1BSg=

before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

after_success:
- mvn clean test jacoco:report coveralls:report
- bash update-ghpages.sh
- mvn clean test jacoco:report coveralls:report
- bash update-ghpages.sh

# Migration to container-based infrastructure
sudo: false
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ If you are willing to contribute to the project you will find the relevant infor

# Credits

* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
* [Effective Java (2nd Edition)](http://www.amazon.com/Effective-Java-Edition-Joshua-Bloch/dp/0321356683)
* [Java Generics and Collections](http://www.amazon.com/Java-Generics-Collections-Maurice-Naftalin/dp/0596527756/)
* [Let's Modify the Objects-First Approach into Design-Patterns-First](http://edu.pecinovsky.cz/papers/2006_ITiCSE_Design_Patterns_First.pdf)
Expand All @@ -48,7 +47,6 @@ If you are willing to contribute to the project you will find the relevant infor
* [Patterns of Enterprise Application Architecture](http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420)
* [Spring Data](http://www.amazon.com/Spring-Data-Mark-Pollack/dp/1449323952/ref=sr_1_1)
* [J2EE Design Patterns](http://www.amazon.com/J2EE-Design-Patterns-William-Crawford/dp/0596004273/ref=sr_1_2)
* [Pattern Oriented Software Architecture Vol I-V](http://www.amazon.com/Pattern-Oriented-Software-Architecture-Volume-Patterns/dp/0471958697)

# License

Expand Down
8 changes: 7 additions & 1 deletion abstract-factory/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: Abstract Factory
folder: abstract-factory
permalink: /patterns/abstract-factory/
categories: Creational
tags: Java
tags:
- Java
- Gang Of Four
---

**Intent:** Provide an interface for creating families of related or dependent
Expand All @@ -22,3 +24,7 @@ objects without specifying their concrete classes.
**Real world examples:**

* [javax.xml.parsers.DocumentBuilderFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html)

**Credits**

* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
2 changes: 1 addition & 1 deletion abstract-factory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>abstract-factory</artifactId>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@

/**
*
* 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}).
* <p>
* The example uses both concrete implementations to create a king, a castle and
* an army.
* {@link OrcKingdomFactory}). The example uses both concrete implementations to
* create a king, a castle and an army.
*
*/
public class App {
Expand Down
8 changes: 7 additions & 1 deletion adapter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: Adapter
folder: adapter
permalink: /patterns/adapter/
categories: Structural
tags: Java
tags:
- Java
- Gang Of Four
---

**Intent:** Convert the interface of a class into another interface the clients
Expand All @@ -22,3 +24,7 @@ incompatible interfaces.
**Real world examples:**

* [java.util.Arrays#asList()](http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList%28T...%29)

**Credits**

* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
2 changes: 1 addition & 1 deletion adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>adapter</artifactId>
<dependencies>
Expand Down
8 changes: 7 additions & 1 deletion adapter/src/main/java/com/iluwatar/adapter/App.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package com.iluwatar.adapter;

/**
*
*
* An adapter helps two incompatible interfaces to work together. This is the real
* world definition for an adapter. Interfaces may be incompatible but the inner
* functionality should suit the need. The Adapter design pattern allows otherwise
* incompatible classes to work together by converting the interface of one class
* into an interface expected by the clients.
* <p>
* There are two variations of the Adapter pattern: The class adapter implements
* the adaptee's interface whereas the object adapter uses composition to
* contain the adaptee in the adapter object. This example uses the object
Expand Down
2 changes: 1 addition & 1 deletion async-method-invocation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>async-method-invocation</artifactId>
<dependencies>
Expand Down
8 changes: 7 additions & 1 deletion bridge/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: Bridge
folder: bridge
permalink: /patterns/bridge/
categories: Structural
tags: Java
tags:
- Java
- Gang Of Four
---

**Intent:** Decouple an abstraction from its implementation so that the two can
Expand All @@ -20,3 +22,7 @@ vary independently.
* changes in the implementation of an abstraction should have no impact on clients; that is, their code should not have to be recompiled.
* you have a proliferation of classes. Such a class hierarchy indicates the need for splitting an object into two parts. Rumbaugh uses the term "nested generalizations" to refer to such class hierarchies
* you want to share an implementation among multiple objects (perhaps using reference counting), and this fact should be hidden from the client. A simple example is Coplien's String class, in which multiple objects can share the same string representation.

**Credits**

* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
2 changes: 1 addition & 1 deletion bridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>bridge</artifactId>
<dependencies>
Expand Down
3 changes: 3 additions & 0 deletions bridge/src/main/java/com/iluwatar/bridge/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

/**
*
* The Bridge pattern can also be thought of as two layers of abstraction. With Bridge,
* you can decouple an abstraction from its implementation so that the two can vary independently.
* <p>
* In Bridge pattern both abstraction ({@link MagicWeapon}) and implementation
* ({@link MagicWeaponImpl}) have their own class hierarchies. The interface of the
* implementations can be changed without affecting the clients.
Expand Down
8 changes: 7 additions & 1 deletion builder/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: Builder
folder: builder
permalink: /patterns/builder/
categories: Creational
tags: Java
tags:
- Java
- Gang Of Four
---

**Intent:** Separate the construction of a complex object from its
Expand All @@ -22,3 +24,7 @@ representations.

* [java.lang.StringBuilder](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)
* [Apache Camel builders](https://github.com/apache/camel/tree/0e195428ee04531be27a0b659005e3aa8d159d23/camel-core/src/main/java/org/apache/camel/builder)

**Credits**

* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
2 changes: 1 addition & 1 deletion builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>builder</artifactId>
<dependencies>
Expand Down
15 changes: 14 additions & 1 deletion builder/src/main/java/com/iluwatar/builder/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@

/**
*
* This is the Builder pattern variation as described by Joshua Bloch in
* The intention of the Builder pattern is to find a solution to the telescoping
* constructor anti-pattern. The telescoping constructor anti-pattern occurs when the
* increase of object constructor parameter combination leads to an exponential list
* of constructors. Instead of using numerous constructors, the builder pattern uses
* another object, a builder, that receives each initialization parameter step by step
* and then returns the resulting constructed object at once.
* <p>
* The Builder pattern has another benefit. It can be used for objects that contain
* flat data (html code, SQL query, X.509 certificate...), that is to say, data that
* can't be easily edited. This type of data cannot be edited step by step and must
* be edited at once. The best way to construct such an object is to use a builder
* class.
* <p>
* In this example we have the Builder pattern variation as described by Joshua Bloch in
* Effective Java 2nd Edition.
* <p>
* We want to build {@link Hero} objects, but its construction is complex because of the
Expand Down
2 changes: 1 addition & 1 deletion business-delegate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>business-delegate</artifactId>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion callback/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>callback</artifactId>
<dependencies>
Expand Down
8 changes: 7 additions & 1 deletion chain/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: Chain of responsibility
folder: chain
permalink: /patterns/chain/
categories: Behavioral
tags: Java
tags:
- Java
- Gang Of Four
---

**Intent:** Avoid coupling the sender of a request to its receiver by giving
Expand All @@ -23,3 +25,7 @@ objects and pass the request along the chain until an object handles it.

* [java.util.logging.Logger#log()](http://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html#log%28java.util.logging.Level,%20java.lang.String%29)
* [Apache Commons Chain](https://commons.apache.org/proper/commons-chain/index.html)

**Credits**

* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
2 changes: 1 addition & 1 deletion chain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>chain</artifactId>
<dependencies>
Expand Down
14 changes: 10 additions & 4 deletions chain/src/main/java/com/iluwatar/chain/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

/**
*
* Chain of Responsibility organizes request handlers ({@link RequestHandler}) into a
* chain where each handler has a chance to act on the request on its turn. In
* this example the king ({@link OrcKing}) makes requests and the military orcs
* ({@link OrcCommander}, {@link OrcOfficer}, {@link OrcSoldier}) form the handler chain.
* The Chain of Responsibility pattern is a design pattern consisting of command
* objects and a series of processing objects. Each processing object contains
* logic that defines the types of command objects that it can handle; the rest are
* passed to the next processing object in the chain. A mechanism also exists for
* adding new processing objects to the end of this chain.
* <p>
* In this example we organize the request handlers ({@link RequestHandler}) into a
* chain where each handler has a chance to act on the request on its turn. Here
* the king ({@link OrcKing}) makes requests and the military orcs ({@link OrcCommander},
* {@link OrcOfficer}, {@link OrcSoldier}) form the handler chain.
*
*/
public class App {
Expand Down
8 changes: 7 additions & 1 deletion command/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: Command
folder: command
permalink: /patterns/command/
categories: Behavioral
tags: Java
tags:
- Java
- Gang Of Four
---

**Intent:** Encapsulate a request as an object, thereby letting you
Expand All @@ -30,3 +32,7 @@ support undoable operations.
**Real world examples:**

* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)

**Credits**

* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
2 changes: 1 addition & 1 deletion command/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>command</artifactId>
<dependencies>
Expand Down
4 changes: 3 additions & 1 deletion command/src/main/java/com/iluwatar/command/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

/**
*
* In Command pattern actions are objects that can be executed and undone.
* The Command pattern is a behavioral design pattern in which an object is used to encapsulate all information
* needed to perform an action or trigger an event at a later time. This information includes the method name,
* the object that owns the method and values for the method parameters.
* <p>
* Four terms always associated with the command pattern are command, receiver, invoker and client. A command
* object (spell) knows about the receiver (target) and invokes a method of the receiver. Values for parameters of
Expand Down
8 changes: 7 additions & 1 deletion composite/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: Composite
folder: composite
permalink: /patterns/composite/
categories: Structural
tags: Java
tags:
- Java
- Gang Of Four
---

**Intent:** Compose objects into tree structures to represent part-whole
Expand All @@ -22,3 +24,7 @@ of objects uniformly.

* [java.awt.Container](http://docs.oracle.com/javase/8/docs/api/java/awt/Container.html) and [java.awt.Component](http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html)
* [Apache Wicket](https://github.com/apache/wicket) component tree, see [Component](https://github.com/apache/wicket/blob/91e154702ab1ff3481ef6cbb04c6044814b7e130/wicket-core/src/main/java/org/apache/wicket/Component.java) and [MarkupContainer](https://github.com/apache/wicket/blob/b60ec64d0b50a611a9549809c9ab216f0ffa3ae3/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java)

**Credits**

* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
2 changes: 1 addition & 1 deletion composite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>
<artifactId>composite</artifactId>
<dependencies>
Expand Down
12 changes: 8 additions & 4 deletions composite/src/main/java/com/iluwatar/composite/App.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.iluwatar.composite;

/**
*
* With Composite we can treat tree hierarchies of objects with uniform
* interface ({@link LetterComposite}). In this example we have sentences composed of
* words composed of letters.
* The Composite pattern is a partitioning design pattern. The Composite pattern
* describes that a group of objects is to be treated in the same way as a single
* instance of an object. The intent of a composite is to "compose" objects into
* tree structures to represent part-whole hierarchies. Implementing the Composite
* pattern lets clients treat individual objects and compositions uniformly.
* <p>
* In this example we have sentences composed of words composed of letters. All of
* the objects can be treated through the same interface ({@link LetterComposite}).
*
*/
public class App {
Expand Down
Loading