/**
* The annotated element must not be {@code null} nor empty.
* <p>
* Supported types are:
* <ul>
* <li>{@code CharSequence} (length of character sequence is evaluated)</li>
* <li>{@code Collection} (collection size is evaluated)</li>
* <li>{@code Map} (map size is evaluated)</li>
* <li>Array (array length is evaluated)</li>
* </ul>
* * @author Emmanuel Bernard
* @author Hardy Ferentschik
* * @since 2.0
*/@Documented@Constraint(validatedBy ={})@Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE})@Retention(RUNTIME)@Repeatable(List.class)public@interfaceNotEmpty{...}
解释
此注解元素校验必须不为null且不为空
可以修饰的数据类型:
CharSequence(字符串)
Collection(集合)
Map(键值对)
Array(数组)
@NotBlank
/**
* The annotated element must not be {@code null} and must contain at least one
* non-whitespace character. Accepts {@code CharSequence}.
*
* @author Hardy Ferentschik
* @since 2.0
*
* @see Character#isWhitespace(char)
*/@Documented@Constraint(validatedBy ={})@Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE})@Retention(RUNTIME)@Repeatable(List.class)public@interfaceNotBlank{...}
解释
此注解元素校验必须不为null且必须包含一个不为空的字符串
只可以修饰的数据类型:CharSequence(字符串)
@NotNull
/**
* The annotated element must not be {@code null}.
* Accepts any type.
*
* @author Emmanuel Bernard
*/@Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE})@Retention(RUNTIME)@Repeatable(List.class)@Documented@Constraint(validatedBy ={})public@interfaceNotNull{...}