com.ideaaedi.commonspring.lite.params.ParameterRecorder Maven / Gradle / Ivy
The newest version!
package com.ideaaedi.commonspring.lite.params;
/**
* 参数记录器
*
* @author JustryDeng
* @since 1.0.0
*/
public @interface ParameterRecorder {
/** 默认格式 */
String POINTCUT_FORMAT =
"("
+ "@within(com.ideaaedi.commonspring.lite.params.RecordParameters)"
+ " || "
+ "@annotation(com.ideaaedi.commonspring.lite.params.RecordParameters)"
+ "%s"
+ ")"
+ " && "
+ "!@annotation(com.ideaaedi.commonspring.lite.params.IgnoreRecordParameters)"
+ "%s";
/** 默认切点 */
String DEFAULT_POINTCUT = String.format(POINTCUT_FORMAT, "", "");
/**
* 需要包含的methodReference前缀
*
*
* 为空则表示全部包含
*
* methodReference形如:com.ideaaedi.commonspring.aop.ParameterRecorderAdvice#init
*
*/
String[] includePrefixes() default {};
/**
* 需要排除的methodReference前缀
*
*
* 为空则表示都不需要排除
*
* methodReference形如:com.ideaaedi.commonspring.aop.ParameterRecorderAdvice#init
*
*/
String[] excludePrefixes() default {};
/**
* 将参数转换为字符串的方式
*/
ParameterHandleModeEnum parameterHandleMode() default ParameterHandleModeEnum.USE_JSON;
/**
* 记录日志时,是否美化
*/
boolean pretty() default true;
/**
* 当参数类型是这些时,不打印该参数
*/
Class[] ignoreParamTypes() default {};
/**
* 切点and匹配
*
* {@code
* 默认切点是:
* @Pointcut(
* "("
* + "@within(com.ideaaedi.commonspring.lite.params.RecordParameters)"
* + " || "
* + "@annotation(com.ideaaedi.commonspring.lite.params.RecordParameters)"
* + ")"
* + " && "
* + "!@annotation(com.ideaaedi.commonspring.lite.params.IgnoreRecordParameters)"
* )
*
* 在最后面增加 && 拼接你配置的切点。假设你配置的切点是execution(* *..*RequestHandler.invoke(..)),那么拼接后形如:
* @Pointcut(
* "("
* + "@within(com.ideaaedi.commonspring.lite.params.RecordParameters)"
* + " || "
* + "@annotation(com.ideaaedi.commonspring.lite.params.RecordParameters)"
* + ")"
* + " && "
* + "!@annotation(com.ideaaedi.commonspring.lite.params.IgnoreRecordParameters)"
* + " && "
* + "execution(* *..*RequestHandler.invoke(..))"
* )
* }
*
*/
String[] pointcutAnd() default {};
/**
* 切点or匹配
*
* {@code
* 默认切点是:
* @Pointcut(
* "("
* + "@within(com.ideaaedi.commonspring.lite.params.RecordParameters)"
* + " || "
* + "@annotation(com.ideaaedi.commonspring.lite.params.RecordParameters)"
* + ")"
* + " && "
* + "!@annotation(com.ideaaedi.commonspring.lite.params.IgnoreRecordParameters)"
* )
*
* 在括号中增加 || 拼接你配置的切点。假设你配置的切点是execution(* *..*RequestHandler.invoke(..)),那么拼接后形如:
* @Pointcut(
* "("
* + "@within(com.ideaaedi.commonspring.lite.params.RecordParameters)"
* + " || "
* + "@annotation(com.ideaaedi.commonspring.lite.params.RecordParameters)"
* + " || "
* + "execution(* *..*RequestHandler.invoke(..))"
* + ")"
* + " && "
* + "!@annotation(com.ideaaedi.commonspring.lite.params.IgnoreRecordParameters)"
* )
* }
*
*/
String[] pointcutOr() default {"execution(* *..*Controller.*(..))"};
}