Annotation Interface Contract.Pattern
- Enclosing class:
Contract
@API(status=MAINTAINED)
@Contract
@Target({PARAMETER,METHOD,FIELD,ANNOTATION_TYPE})
@Retention(RUNTIME)
@Documented
public static @interface Contract.Pattern
Requires a character sequence to match the configured regular expression when non-null.
Supported values are CharSequence instances. A null
object value is ignored and therefore passes. Pattern evaluation uses
Matcher.matches(), so the full sequence must match
the expression.
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
regexp
String regexpRegular expression that the full character sequence must match.- Returns:
- the Java regular expression
-
message
String messageCustom 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:
""
-