Search in sources :

Example 1 with EzyDuplicateRequestHandlerException

use of com.tvd12.ezyfoxserver.support.exception.EzyDuplicateRequestHandlerException in project ezyfox-server by youngmonkeys.

the class EzyRequestHandlersImplementer method implement.

public Map<String, EzyUserRequestHandler> implement(Collection<Object> controllers) {
    Map<String, EzyUserRequestHandler> handlers = new HashMap<>();
    for (Object controller : controllers) {
        Map<String, EzyUserRequestHandler> map = implement(controller);
        for (String command : map.keySet()) {
            EzyUserRequestHandler handler = map.get(command);
            EzyUserRequestHandler old = handlers.put(command, handler);
            if (old != null && !allowOverrideCommand) {
                throw new EzyDuplicateRequestHandlerException(command, old, handler);
            }
        }
    }
    return handlers;
}
Also used : HashMap(java.util.HashMap) EzyDuplicateRequestHandlerException(com.tvd12.ezyfoxserver.support.exception.EzyDuplicateRequestHandlerException) EzyUserRequestHandler(com.tvd12.ezyfoxserver.support.handler.EzyUserRequestHandler)

Aggregations

EzyDuplicateRequestHandlerException (com.tvd12.ezyfoxserver.support.exception.EzyDuplicateRequestHandlerException)1 EzyUserRequestHandler (com.tvd12.ezyfoxserver.support.handler.EzyUserRequestHandler)1 HashMap (java.util.HashMap)1