#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
|
* 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
|
* this example the king ({@link OrcKing}) makes requests and the military orcs
|
||||||
* (OrcCommander, OrcOfficer, OrcSoldier) form the handler chain.
|
* ({@link OrcCommander}, {@link OrcOfficer}, {@link OrcSoldier}) form the handler chain.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Program entry point
|
||||||
|
* @param args command line args
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
OrcKing king = new OrcKing();
|
OrcKing king = new OrcKing();
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.chain;
|
package com.iluwatar.chain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* OrcCommander
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class OrcCommander extends RequestHandler {
|
public class OrcCommander extends RequestHandler {
|
||||||
|
|
||||||
public OrcCommander(RequestHandler handler) {
|
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 {
|
public class OrcKing {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.chain;
|
package com.iluwatar.chain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* OrcOfficer
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class OrcOfficer extends RequestHandler {
|
public class OrcOfficer extends RequestHandler {
|
||||||
|
|
||||||
public OrcOfficer(RequestHandler handler) {
|
public OrcOfficer(RequestHandler handler) {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.chain;
|
package com.iluwatar.chain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* OrcSoldier
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class OrcSoldier extends RequestHandler {
|
public class OrcSoldier extends RequestHandler {
|
||||||
|
|
||||||
public OrcSoldier(RequestHandler handler) {
|
public OrcSoldier(RequestHandler handler) {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.chain;
|
package com.iluwatar.chain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Request
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Request {
|
public class Request {
|
||||||
|
|
||||||
private String requestDescription;
|
private String requestDescription;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.chain;
|
package com.iluwatar.chain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* RequestHandler
|
||||||
|
*
|
||||||
|
*/
|
||||||
public abstract class RequestHandler {
|
public abstract class RequestHandler {
|
||||||
|
|
||||||
private RequestHandler next;
|
private RequestHandler next;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar.chain;
|
package com.iluwatar.chain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* RequestType enumeration
|
||||||
|
*
|
||||||
|
*/
|
||||||
public enum RequestType {
|
public enum RequestType {
|
||||||
|
|
||||||
DEFEND_CASTLE, TORTURE_PRISONER, COLLECT_TAX
|
DEFEND_CASTLE, TORTURE_PRISONER, COLLECT_TAX
|
||||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import com.iluwatar.chain.App;
|
import com.iluwatar.chain.App;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Application test
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class AppTest {
|
public class AppTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user