Annotation Interface AssertFalse


@Retention(RUNTIME) @Target(METHOD) public @interface AssertFalse
Validates that a no-arg method returns false.

Place on a zero-parameter method returning boolean or Boolean. The method is invoked during validation; a false return passes, a true return fails. A null Boolean return is treated as valid (pair with field constraints if absence must fail).

Typical use is cross-field rules:


 @AssertFalse(message = "debug must be off in production", path = "debug")
 private boolean isDebugEnabledInProduction() {
     return production && debug;
 }
 
  • Optional Element Summary

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

    • message

      String message
      The error message.
      Returns:
      the message
      Default:
      "Expression must be false"
    • path

      String path
      Relative property path for the validation error (e.g. "debug" or "database.host"). Empty uses the method name as the path segment.
      Returns:
      the relative path, or empty for the method name
      Default:
      ""
    • 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:
      "Ensure the assertion evaluates to false"