| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
fmms
12年前发布

Bean验证框架 Hibernate Validator

     <p>用Annotations 给类或者类的属性加上约束(constraint),在运行期检查属性值是很优雅的.Hibernate Validator就是这样的一个框架.该框架是十分容易的(就像参考文档中宣称的那样),几乎没有什么学习曲线,Validator 是一个验证框架 不需要和Hibernate的其他部分绑定就可以使用,只要在你的项目中添加Hibernate-annotations.jar库就可以了.</p>    <p>示例代码:</p>    <pre class="brush:java; toolbar: true; auto-links: false;">public class Address {      @NotNull private String line1;     private String line2;     private String zip;     private String state;          @Length(max = 20)     @NotNull     private String country;      @Range(min = -2, max = 50, message = "Floor out of range")     public int floor;          ... }</pre>    <p></p>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326112512328" target="_blank">http://www.open-open.com/lib/view/home/1326112512328</a></p>     
 本文由用户 fmms 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1326112512328.html
Hibernate Java开发