Class ValidateInterceptor
- java.lang.Object
-
- net.cofcool.chaos.server.core.aop.AbstractScannedMethodInterceptor
-
- net.cofcool.chaos.server.core.aop.ValidateInterceptor
-
- All Implemented Interfaces:
ScannedMethodInterceptor
public class ValidateInterceptor extends AbstractScannedMethodInterceptor
参数校验切面, 处理含有BindingResult参数的方法, 通过拦截Controller实现, 被代理类需使用Scanned注解。- Author:
- zq, CofCool
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description ValidateInterceptor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoBefore(org.aopalliance.intercept.MethodInvocation invocation)invocation 调用前调用protected booleandoSupport(Method method, Class<?> targetClass)是否支持static StringgetFirstErrorString(org.springframework.validation.BindingResult result)从BindingResult中读取验证信息, 如果没有, 则返回 nullprotected voidvalidate(org.aopalliance.intercept.MethodInvocation invocation)处理 BindingResult 携带的验证信息-
Methods inherited from class net.cofcool.chaos.server.core.aop.AbstractScannedMethodInterceptor
doAfter, postAfter, postBefore, supports
-
-
-
-
Method Detail
-
validate
protected void validate(org.aopalliance.intercept.MethodInvocation invocation) throws Exception处理 BindingResult 携带的验证信息- Throws:
Exception
-
getFirstErrorString
@Nullable public static String getFirstErrorString(org.springframework.validation.BindingResult result)
从BindingResult中读取验证信息, 如果没有, 则返回 null- Parameters:
result- BindingResult 实例- Returns:
- 验证信息
-
doSupport
protected boolean doSupport(Method method, Class<?> targetClass)
Description copied from class:AbstractScannedMethodInterceptor是否支持- Specified by:
doSupportin classAbstractScannedMethodInterceptor- Parameters:
method- methodtargetClass- targetClass- Returns:
- 是否支持
-
doBefore
protected void doBefore(org.aopalliance.intercept.MethodInvocation invocation) throws ThrowableDescription copied from class:AbstractScannedMethodInterceptorinvocation 调用前调用- Overrides:
doBeforein classAbstractScannedMethodInterceptor- Throws:
Throwable
-
-