本文整理汇总了Java中com.alibaba.dubbo.validation.Validator类的典型用法代码示例。如果您正苦于以下问题:Java Validator类的具体用法?Java Validator怎么用?Java Validator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Validator类属于com.alibaba.dubbo.validation包,在下文中一共展示了Validator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import com.alibaba.dubbo.validation.Validator; //导入依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
if (validation != null && ! invocation.getMethodName().startsWith("$")
&& ConfigUtils.isNotEmpty(invoker.getUrl().getMethodParameter(invocation.getMethodName(), Constants.VALIDATION_KEY))) {
try {
Validator validator = validation.getValidator(invoker.getUrl());
if (validator != null) {
validator.validate(invocation.getMethodName(), invocation.getParameterTypes(), invocation.getArguments());
}
} catch (RpcException e) {
throw e;
} catch (Throwable t) {
throw new RpcException(t.getMessage(), t);
}
}
return invoker.invoke(invocation);
}
示例2: invoke
import com.alibaba.dubbo.validation.Validator; //导入依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
if (validation != null && !invocation.getMethodName().startsWith("$")
&& ConfigUtils.isNotEmpty(invoker.getUrl().getMethodParameter(invocation.getMethodName(), Constants.VALIDATION_KEY))) {
try {
Validator validator = validation.getValidator(invoker.getUrl());
if (validator != null) {
validator.validate(invocation.getMethodName(), invocation.getParameterTypes(), invocation.getArguments());
}
} catch (RpcException e) {
throw e;
} catch (Throwable t) {
throw new RpcException(t.getMessage(), t);
}
}
return invoker.invoke(invocation);
}
示例3: getValidator
import com.alibaba.dubbo.validation.Validator; //导入依赖的package包/类
public Validator getValidator(URL url) {
String key = url.toFullString();
Validator validator = validators.get(key);
if (validator == null) {
validators.put(key, createValidator(url));
validator = validators.get(key);
}
return validator;
}
示例4: invoke
import com.alibaba.dubbo.validation.Validator; //导入依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation invocation) throws JahhanException {
if (validation != null && ! invocation.getMethodName().startsWith("$")) {
try {
Validator validator = validation.getValidator(invoker.getUrl());
if (validator != null) {
validator.validate(invocation.getMethodName(), invocation.getParameterTypes(), invocation.getArguments());
}
} catch (JahhanException e) {
throw e;
} catch (Throwable t) {
throw new JahhanException(t.getMessage(), t);
}
}
return invoker.invoke(invocation);
}
示例5: createValidator
import com.alibaba.dubbo.validation.Validator; //导入依赖的package包/类
@Override
protected Validator createValidator(URL url) {
return new JValidator(url);
}