본문 바로가기

open source

JSR 303 정리 중...

1. @NotNull  vs  @NotEmpty  vs  @NotBlank



String name = null 인 경우...

 @NotNull

 false

 @NotEmpty

 false

 @NotBlank

 false



String name = "" 인 경우...

 @NotNull

 true

 @NotEmpty

 false

 @NotBlank

 false



String name = " " (white space가 있을 경우)인 경우...

 @NotNull

 true

 @NotEmpty

 true

 @NotBlank

 false



String name = "aaaa" (문자열 있을 경우)

 @NotNull

 true

 @NotEmpty

 true

 @NotBlank

 true