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

com.ideaaedi.commonspring.lite.params.ParameterRecorderCustomizer Maven / Gradle / Ivy

The newest version!
package com.ideaaedi.commonspring.lite.params;

import org.springframework.core.Ordered;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.StandardReflectionParameterNameDiscoverer;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

import java.lang.reflect.Method;

/**
 * (non-javadoc)
 *
 * @author JustryDeng 
 * @since 1.0.0
 */
public interface ParameterRecorderCustomizer {
    
    /**
     * 定制参数序列化器
     * 

* 在打印日志时的,会用此序列化器将参数序列化为字符串 *

* * @return 参数序列化器 */ @Nullable default ParameterSerializer customParameterSerializer() { return null; } /** * 定制请求入口判断器 *

* 判断是否是请求入口 *

* * @return 定制请求入口判断器 */ @NonNull default RequestEntranceJudger customRequestEntranceJudger() { return new RequestEntranceJudger() { @Override public boolean ifEntrance(@NonNull Class targetClazz, @NonNull Method targetMethod, Object[] arguments) { return targetClazz.getCanonicalName().endsWith("Controller"); } }; } /** * 定制请求路径提供器 *

* 请求进出口方法在打印日志时 * (即:{@link RequestEntranceJudger#ifEntrance(Class, Method, Object[])}返回为true时), * 会将请求路径(由{@link RequestPathProvider}提供)也一并打印 *

* * @return 请求路径提供器 */ @Nullable default RequestPathProvider customRequestPathProvider() { return null; } /** * 定制参数名解析器 * * @return 参数名解析器 */ @Nullable default ParameterNameDiscoverer customParameterNameDiscoverer() { return new StandardReflectionParameterNameDiscoverer(); } /** * 定制aop优先级 * * @return 定制aop优先级 */ @NonNull default int customAdviceOrder() { return Ordered.HIGHEST_PRECEDENCE; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy