Annotation Interface Contract.NotEmpty

Enclosing class:
Contract

@API(status=MAINTAINED) @Contract @Target({PARAMETER,METHOD,FIELD,ANNOTATION_TYPE}) @Retention(RUNTIME) @Documented public static @interface Contract.NotEmpty
Requires a character sequence, collection, map, or array value to be non-empty when non-null.

Supported values are CharSequence, Collection, Map, and arrays. A null object value is ignored and therefore passes. Empty supported values fail.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Custom violation description.
  • Element Details

    • message

      String message
      Custom violation description.

      When non-empty, this text replaces the generated contract description while preserving location details, exception type, and masking behavior.

      Returns:
      the custom violation description, or an empty string to use the generated description
      Default:
      ""