![JAR search and dependency download from the Maven repository](/logo.png)
com.tvd12.ezymq.common.handler.EzyMQRequestHandler Maven / Gradle / Ivy
package com.tvd12.ezymq.common.handler;
import com.tvd12.ezyfox.exception.EzyNotImplementedException;
import com.tvd12.ezyfox.reflect.EzyGenerics;
public interface EzyMQRequestHandler {
default Object handle(R request) throws Exception {
process(request);
return Boolean.TRUE;
}
default void process(R request) throws Exception {}
default Class> getRequestType() {
try {
Class> handlerClass = getClass();
Class>[] args = EzyGenerics.getGenericInterfacesArguments(
handlerClass,
EzyMQRequestHandler.class,
1
);
return args[0];
} catch (Exception e) {
throw new EzyNotImplementedException(
"unknown request type of: " + getClass().getName() +
", you must implement getRequestType method"
);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy