mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-14 10:18:39 +00:00
Commented chain of responsibility example.
This commit is contained in:
1 parent
1cdb59352d
commit
6b843f028a
2 files changed
+13
No files matched your search
@@ -1,5 +1,13 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Chain of Responsibility organizes request handlers (RequestHandler) into
|
||||||
|
* a chain where each handler has a chance to act on the request on its
|
||||||
|
* turn. In this example the king (OrcKing) makes requests and the military
|
||||||
|
* orcs (OrcCommander, OrcOfficer, OrcSoldier) form the handler chain.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class App
|
public class App
|
||||||
{
|
{
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Makes requests that are handled by the chain.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class OrcKing {
|
public class OrcKing {
|
||||||
|
|
||||||
RequestHandler chain;
|
RequestHandler chain;
|
||||||
|
|||||||
Reference in new issue
Block a user