表格字段常用注解@NotBlank @NotEmpty @NotNul @Pattern

在Hibernate Validator(org.hibernate.validator.constraints)中:
@NotEmpty://CharSequence, Collection, Map 和 Array 对象不能是 null 并且相关对象的 size 大于 0。  
@NotBlank://String 不是 null 且去除两端空白字符后的长度(trimmed length)大于 0。
例子:@NotBlank(message = "城市名不能为空")
 
在java EE中:
@Pattern(regexp = "^[1-9]\d?(\.\d)?$|^100$|^100\.0$", message = "当月目标值格式错误,请确保为1到100且不超过一位小数的数字")
只能修饰string类型的字段
@NotNull://CharSequence, Collection, Map 和 Array 对象不能是 null, 但可以是空集(size = 0)。  
官方文档:
 
另一篇博客(http://blog.csdn.net/zz_life/article/details/51470909比较粗暴的总结
@NotEmpty 用在集合类上面
@NotBlank 用在String上面
@NotNull 用在基本类型上
原文地址:https://www.cnblogs.com/goingforward/p/6803378.html