Annotation Interface NotEmpty


@Retention(RUNTIME) @Target(FIELD) public @interface NotEmpty
Validates that a field is not null and not empty.

Supports CharSequence (empty when length() == 0), Collection and Map (empty when isEmpty()), and arrays (empty when their length is zero). A null value always fails this constraint. Any other non-null type whose emptiness cannot be measured is also treated as invalid.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether validation failure should fail fast (prevent plugin enable).
    The error message.
    The suggestion shown after the error message describing how to fix it.
  • Element Details

    • message

      String message
      The error message.
      Returns:
      the message
      Default:
      "Value cannot be empty"
    • failFast

      boolean failFast
      Whether validation failure should fail fast (prevent plugin enable).
      Returns:
      true to fail fast
      Default:
      true
    • suggestion

      String suggestion
      The suggestion shown after the error message describing how to fix it. Set to an empty string to omit the suggestion entirely.
      Returns:
      the suggestion
      Default:
      "Provide at least one value"