Annotation 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 ElementsModifier and TypeOptional ElementDescriptionbooleanWhether 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 messageThe error message.- Returns:
- the message
- Default:
- "Expression must be false"
-
path
String pathRelative 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 failFastWhether validation failure should fail fast (prevent plugin enable).- Returns:
- true to fail fast
- Default:
- true
-
suggestion
String suggestionThe 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"
-