本文整理汇总了Java中com.baidu.unbiz.fluentvalidator.ValidatorContext.addErrorMsg方法的典型用法代码示例。如果您正苦于以下问题:Java ValidatorContext.addErrorMsg方法的具体用法?Java ValidatorContext.addErrorMsg怎么用?Java ValidatorContext.addErrorMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.baidu.unbiz.fluentvalidator.ValidatorContext
的用法示例。
在下文中一共展示了ValidatorContext.addErrorMsg方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Company company) {
if (company.getId() <= 0) {
context.addErrorMsg(String.format(ErrorMsg.COMPANY_ID_INVALID.msg(), company.getId()));
return false;
}
Date date = company.getEstablishTime();
// company established time must before 2010-1-1
if (date.after(DateUtil.getDate(2010, 1, 1))) {
context.addErrorMsg(String.format(ErrorMsg.COMPANY_DATE_INVALID.msg(), date));
return false;
}
return true;
}
示例2: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Integer t) {
if (t != 2 && t != 5 && t != 7) {
context.addErrorMsg(String.format(CarError.SEATCOUNT_ERROR.msg(), t));
return false;
}
return true;
}
示例3: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Car car) {
Closure<List<String>> closure = context.getClosure("manufacturerClosure");
if (closure != null) {
List<String> manufacturers = closure.executeAndGetResult();
if (!manufacturers.contains(car.getManufacturer())) {
context.addErrorMsg(String.format(CarError.MANUFACTURER_ERROR.msg(), car.getManufacturer()));
return false;
}
}
return true;
}
示例4: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, String t) {
if (t.startsWith("NYC") || t.startsWith("LA") || t.startsWith("BEIJING")) {
if (!normalMockRpcService.isValid(t)) {
context.addErrorMsg(String.format(CarError.LICENSEPLATE_ERROR.msg(), t));
return false;
}
} else {
if (abNormalMockRpcService.isValid(t)) {
context.addErrorMsg(String.format(CarError.LICENSEPLATE_ERROR.msg(), t));
return false;
}
}
return true;
}
示例5: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Object t) {
if (t == null) {
context.addErrorMsg("Null is not expected!");
return false;
}
return true;
}
示例6: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Car car) {
if (car.getSeatCount() != 2 && car.getSeatCount() != 5 && car.getSeatCount() != 7) {
context.addErrorMsg(String.format(CarError.SEATCOUNT_ERROR.msg(), car.getSeatCount()));
return false;
}
return true;
}
示例7: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, String t) {
Boolean ignoreManufacturer = context.getAttribute("ignoreManufacturer", Boolean.class);
if (ignoreManufacturer != null && ignoreManufacturer) {
return true;
}
if (!manufacturerService.getAllManufacturers().contains(t)) {
context.addErrorMsg(String.format(CarError.MANUFACTURER_ERROR.msg(), t));
return false;
}
return true;
}
示例8: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Car car) {
if (!car.getLicensePlate().startsWith("NYC")
&& !car.getLicensePlate().startsWith("LA")
&& !car.getLicensePlate().startsWith("BEIJING")) {
context.addErrorMsg(String.format(CarError.LICENSEPLATE_ERROR.msg(), car.getLicensePlate()));
return false;
}
return true;
}
示例9: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Integer t) {
if (t < 2) {
context.addErrorMsg(String.format(CarError.SEATCOUNT_ERROR.msg(), t));
return false;
}
return true;
}
示例10: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, List<Car> cars) {
if (CollectionUtil.isEmpty(cars)) {
context.addErrorMsg("Cars is empty");
return false;
}
return true;
}
示例11: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Object obj) {
if (obj == null) {
context.addErrorMsg("Input should not be NULL");
return false;
}
return true;
}
示例12: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, List<Car> t) {
if (t.size() > 10) {
context.addErrorMsg(MessageSupport.getText(CarError.CAR_SIZE_EXCEED.msg()));
return false;
}
return true;
}
示例13: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, String t) {
if (t.startsWith("NYC") || t.startsWith("LA") || t.startsWith("BEIJING")) {
if (!normalMockRpcService.isValid(t)) {
context.addErrorMsg(String.format(CarError.LICENSEPLATE_ERROR.msg(), t));
return false;
}
} else {
return abNormalMockRpcService.isValid(t);
}
return true;
}
示例14: validate
import com.baidu.unbiz.fluentvalidator.ValidatorContext; //导入方法依赖的package包/类
@Override
public boolean validate(ValidatorContext context, Object t) {
String methodName = (String) context.getAttribute(MethodNameFluentValidatorPostProcessor.KEY_METHOD_NAME);
System.out.println("MethodName = " + methodName);
if (t == null) {
context.addErrorMsg(CarError.CAR_NULL.msg());
return false;
}
return true;
}