com.cybermkd.route.handler.HandlerFactory Maven / Gradle / Ivy
package com.cybermkd.route.handler;
import java.util.List;
/**
* HandlerFactory.
*/
public class HandlerFactory {
private HandlerFactory() {
}
/**
* Build handler chain
*/
public static Handler getHandler(List handlerList, Handler actionHandler) {
Handler result = actionHandler;
for (int i = handlerList.size() - 1; i >= 0; i--) {
Handler temp = handlerList.get(i);
temp.nextHandler = result;
result = temp;
}
return result;
}
}