Java对象验证框架 OVal

码农软件 · 软件分类 · 服务框架/平台 · 2019-09-26 20:58:17

软件介绍

OVal 是一个可扩展的Java对象数据验证框架,验证的规则可以通过配置文件、Annotation、POJOs 进行设定。可以使用纯 Java 语言、JavaScript 、Groovy 、BeanShell 等进行规则的编写。

示例代码:

private static class TestEntity
{
@Min(1960)
private int year = 1977;

@Range(min=1, max=12)
private int month = 2;

@ValidateWithMethod(methodName = "isValidDay", parameterType = int.class)
private int day = 31;

private boolean isValidDay(int day)
{
GregorianCalendar cal = new GregorianCalendar();
cal.setLenient(false);
cal.set(GregorianCalendar.YEAR, year);
cal.set(GregorianCalendar.MONTH, month - 1);
cal.set(GregorianCalendar.DATE, day);
try {
cal.getTimeInMillis(); // throws IllegalArgumentException
} catch (IllegalArgumentException e) {
return false;
}
return true;
}
}

本文地址:https://codercto.com/soft/d/15472.html

Design systems

Design systems

Not all design systems are equally effective. Some can generate coherent user experiences, others produce confusing patchwork designs. Some inspire teams to contribute to them, others are neglected. S......一起来看看 《Design systems》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

SHA 加密
SHA 加密

SHA 加密工具