@NotEmpty for collections
@NotBlank for String
@NotNull for primitives
There are only simple results, but I can't find any more specific content, so I went to the source code and found the following comments:
1. @NotEmpty
/**
* Asserts that the annotated string, collection, map or array is not {@code null} or empty.
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
*/
That is to say, the String class, Collection, Map, and array with @NotEmpty added cannot be null or have a length of 0 (the isEmpty() method of String, Collection, and Map).
2. @NotBlank
/**
* Validate that the annotated string is not {@code null} or empty.
* The difference to {@code NotEmpty} is that trailing whitespaces are getting ignored.
*
* @author Hardy Ferentschik
*/
“The difference to {@code NotEmpty} is that trailing whitespaces are getting ignored.” –> Unlike {@code NotEmpty}, trailing spaces are ignored, that is, Strings with pure spaces are also illegal. That's why it is said that @NotBlank is used for String.
3. @NotNull
/**
* The annotated element must not be {@code null}.
* Accepts any type.
*
* @author Emmanuel Bernard
*/
This is easy to understand, it cannot be null.