#107 Chain example JavaDoc improvements
This commit is contained in:
parent
b3b6479f6f
commit
fa0acb4366
@ -2,14 +2,18 @@ package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* Chain of Responsibility organizes request handlers (RequestHandler) into a
|
||||
* 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 (OrcKing) makes requests and the military orcs
|
||||
* (OrcCommander, OrcOfficer, OrcSoldier) form the handler chain.
|
||||
* this example the king ({@link OrcKing}) makes requests and the military orcs
|
||||
* ({@link OrcCommander}, {@link OrcOfficer}, {@link OrcSoldier}) form the handler chain.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
OrcKing king = new OrcKing();
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* OrcCommander
|
||||
*
|
||||
*/
|
||||
public class OrcCommander extends RequestHandler {
|
||||
|
||||
public OrcCommander(RequestHandler handler) {
|
||||
|
@ -2,7 +2,7 @@ package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* Makes requests that are handled by the chain.
|
||||
* OrcKing makes requests that are handled by the chain.
|
||||
*
|
||||
*/
|
||||
public class OrcKing {
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* OrcOfficer
|
||||
*
|
||||
*/
|
||||
public class OrcOfficer extends RequestHandler {
|
||||
|
||||
public OrcOfficer(RequestHandler handler) {
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* OrcSoldier
|
||||
*
|
||||
*/
|
||||
public class OrcSoldier extends RequestHandler {
|
||||
|
||||
public OrcSoldier(RequestHandler handler) {
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* Request
|
||||
*
|
||||
*/
|
||||
public class Request {
|
||||
|
||||
private String requestDescription;
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* RequestHandler
|
||||
*
|
||||
*/
|
||||
public abstract class RequestHandler {
|
||||
|
||||
private RequestHandler next;
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* RequestType enumeration
|
||||
*
|
||||
*/
|
||||
public enum RequestType {
|
||||
|
||||
DEFEND_CASTLE, TORTURE_PRISONER, COLLECT_TAX
|
||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
||||
|
||||
import com.iluwatar.chain.App;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user