@TargetSE(valueSE={METHODSE,PARAMETERSE,FIELDSE}) @RetentionSE(valueSE=RUNTIMESE) @DocumentedSE @NonnullSE @TypeQualifierNicknameSE public @interface NonNull
null
にはできないことを宣言するための一般的な Spring アノテーション。JSR-305 メタアノテーションを利用して、JSR-305 をサポートする一般的なツールに対して Java の null 可能性を示し、Kotlin が Spring API の null 可能性を推測するために使用します。
パラメーター、戻り値、フィールドレベルで使用する必要があります。メソッドのオーバーライドは、動作が異なる場合を除き、親 @NonNull
アノテーションを繰り返す必要があります。
@NonNullApi
(スコープ = パラメーター + 戻り値)または @NonNullFields
(スコープ = フィールド)を使用して、コードベース全体に @NonNull
でアノテーションを付けないように、デフォルトの動作を null 不可に設定します。
NonNullApi
, NonNullFields
, Nullable