mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 08:58:49 +00:00
added chain of responsibility sample
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public class OrcKing {
|
||||
|
||||
RequestHandler chain;
|
||||
|
||||
public OrcKing() {
|
||||
buildChain();
|
||||
}
|
||||
|
||||
private void buildChain() {
|
||||
chain = new OrcCommander(new OrcOfficer(new OrcSoldier(null)));
|
||||
}
|
||||
|
||||
public void makeRequest(Request req) {
|
||||
chain.handleRequest(req);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user