Resolves checkstyle errors for callback, chain, circuit-breaker (#1060)
* Reduces checkstyle errors in callback * Reduces checkstyle errors in chain * Reduces checkstyle errors in circuit-breaker
This commit is contained in:
committed by
Ilkka Seppälä
parent
efc17fcc70
commit
31f27a720b
@ -24,23 +24,21 @@
|
||||
package com.iluwatar.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.
|
||||
*
|
||||
*
|
||||
* <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 {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
*
|
||||
* Program entry point.
|
||||
*
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* OrcCommander
|
||||
*
|
||||
* OrcCommander.
|
||||
*/
|
||||
public class OrcCommander extends RequestHandler {
|
||||
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* OrcKing makes requests that are handled by the chain.
|
||||
*
|
||||
*/
|
||||
public class OrcKing {
|
||||
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* OrcOfficer
|
||||
*
|
||||
* OrcOfficer.
|
||||
*/
|
||||
public class OrcOfficer extends RequestHandler {
|
||||
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* OrcSoldier
|
||||
*
|
||||
* OrcSoldier.
|
||||
*/
|
||||
public class OrcSoldier extends RequestHandler {
|
||||
|
||||
|
@ -26,24 +26,24 @@ package com.iluwatar.chain;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Request
|
||||
* Request.
|
||||
*/
|
||||
public class Request {
|
||||
|
||||
/**
|
||||
* The type of this request, used by each item in the chain to see if they should or can handle
|
||||
* this particular request
|
||||
* this particular request.
|
||||
*/
|
||||
private final RequestType requestType;
|
||||
|
||||
/**
|
||||
* A description of the request
|
||||
* A description of the request.
|
||||
*/
|
||||
private final String requestDescription;
|
||||
|
||||
/**
|
||||
* Indicates if the request is handled or not. A request can only switch state from unhandled to
|
||||
* handled, there's no way to 'unhandle' a request
|
||||
* handled, there's no way to 'unhandle' a request.
|
||||
*/
|
||||
private boolean handled;
|
||||
|
||||
@ -59,7 +59,7 @@ public class Request {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a description of the request
|
||||
* Get a description of the request.
|
||||
*
|
||||
* @return A human readable description of the request
|
||||
*/
|
||||
@ -69,7 +69,7 @@ public class Request {
|
||||
|
||||
/**
|
||||
* Get the type of this request, used by each person in the chain of command to see if they should
|
||||
* or can handle this particular request
|
||||
* or can handle this particular request.
|
||||
*
|
||||
* @return The request type
|
||||
*/
|
||||
@ -78,14 +78,14 @@ public class Request {
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the request as handled
|
||||
* Mark the request as handled.
|
||||
*/
|
||||
public void markHandled() {
|
||||
this.handled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this request is handled or not
|
||||
* Indicates if this request is handled or not.
|
||||
*
|
||||
* @return <tt>true</tt> when the request is handled, <tt>false</tt> if not
|
||||
*/
|
||||
|
@ -27,9 +27,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* RequestHandler
|
||||
*
|
||||
* RequestHandler.
|
||||
*/
|
||||
public abstract class RequestHandler {
|
||||
|
||||
@ -42,7 +40,7 @@ public abstract class RequestHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request handler
|
||||
* Request handler.
|
||||
*/
|
||||
public void handleRequest(Request req) {
|
||||
if (next != null) {
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.chain;
|
||||
|
||||
/**
|
||||
*
|
||||
* RequestType enumeration
|
||||
*
|
||||
* RequestType enumeration.
|
||||
*/
|
||||
public enum RequestType {
|
||||
|
||||
|
Reference in New Issue
Block a user