class HandlerPipeline implements Handler {
    private List<Handler> chain = new LinkedList<>();

    /**
     * 下一步
     * */
    public HandlerPipeline next(Handler handler) {
        chain.add(handler);
        return this;
    }

    /**
     * 上一步
     * */
    public HandlerPipeline prev(Handler handler) {
        chain.add(0, handler);
        return this;
    }

    @Override
    public void handle(Context ctx) throws Throwable {<FILL_FUNCTION_BODY>}
}

        for (Handler h : chain) {
            if (ctx.getHandled()) {
                break;
            }

            h.handle(ctx);
        }
    
<no_super_class>