Intent
Let more than one object handle a request without their knowing each other. Pass the request to chained objects until it has been handled.
Where to use & benefits
- One request should be handled by more than one object.
- Don't know which object should handle a request, probably more than one object will handle it automatically.
- Reduce coupling and flexible in handling a request.
Structure

Participants
Handler (ShapeContainerContext)
It defines an interface for handling the requests.
ConcreteHandler (ShapeContainer)
It handles those request for which it is responsible. It it is not able to handle the request then it forwards the request to its successor.
Client (MainApplet)
This initiates the request to a concreteHandler object on the chain.
Example
In the demonstration application, the operation like add, remove, shape to the container is handled by ShapeContainerContext class, but the request to add and remove shape delegated to the state (ShapeContainerFullState, ShapeContainerEmptyState and ShapeContainerPartialState) objects, which in turn delegate to the ShapeContainer to perform the operation.