org.khasanof.feature.interceptor.invoke.InvokerMethodParamsInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boot-starter-fluent Show documentation
Show all versions of spring-boot-starter-fluent Show documentation
Fluent - Easy Telegram Bots with Spring
The newest version!
package org.khasanof.feature.interceptor.invoke;
import org.khasanof.feature.interceptor.InvokerMethodInterceptor;
import org.khasanof.models.invoker.InvokerParam;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
/**
* @author Nurislom
* @see org.khasanof.feature.interceptor.invoke
* @since 2/25/2024 8:12 PM
*/
@Component
public class InvokerMethodParamsInterceptor implements InvokerMethodInterceptor {
@Override
public void preHandle(Map.Entry entry, Map params) {
internalPreHandle(params, entry.getKey());
}
private void internalPreHandle(Map params, Method method) {
if (method.getParameterCount() > 0) {
params.put(InvokerParam.METHOD_PARAMETER_TYPES, Arrays.asList(method.getParameterTypes()));
}
}
}