Class AbstractHandler

java.lang.Object
Behavioral.ChainOfResponsibility.AbstractHandler
All Implemented Interfaces:
Handler
Direct Known Subclasses:
ConcreteHandlerA, ConcreteHandlerB

public abstract class AbstractHandler extends Object implements Handler
Abstract base class that implements the chaining mechanism.
  • Constructor Details

    • AbstractHandler

      public AbstractHandler()
      Default constructor for AbstractHandler.
  • Method Details

    • setNext

      public Handler setNext(Handler next)
      Description copied from interface: Handler
      Sets the next handler in the chain.
      Specified by:
      setNext in interface Handler
      Parameters:
      next - The next handler.
      Returns:
      The current handler for chaining.
    • handleRequest

      public void handleRequest(String request)
      Description copied from interface: Handler
      Handles the request or forwards it to the next handler.
      Specified by:
      handleRequest in interface Handler
      Parameters:
      request - The request to handle.