package cn.axzo.workflow.starter.handler.execute.interceptor;

import cn.axzo.workflow.starter.handler.execute.ListenerExecutor;

import java.util.function.Consumer;

public final class ExecutorInvoker extends AbstractListenerInterceptor {

    @Override
    public <T> void execute(ListenerExecutor executor, Consumer<T> consumer, T t) {
        consumer.accept(t);
    }

    @Override
    public ExecuteInterceptor getNext() {
        return null;
    }

    @Override
    public void setNext(ExecuteInterceptor next) {
        throw new UnsupportedOperationException("ExecutorInvoker must be the last interceptor in the chain");
    }

}
