All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.khasanof.feature.interceptor.invoke.InvokerMethodParamsInterceptor Maven / Gradle / Ivy

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()));
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy