@Retention(value=SOURCE) @Target(value=METHOD) public @interface TriggerPattern
public static
, the return type must either be assignable to
ErrorDescription
or to Iterable
<? extends
ErrorDescription
>
.
Its sole parameter must be HintContext
.Modifier and Type | Required Element and Description |
---|---|
String |
value
Pattern to match on.
|
Modifier and Type | Optional Element and Description |
---|---|
ConstraintVariableType[] |
constraints
Expected types for variables from the
pattern . |
public abstract String value
$
) can be used to replace part of the pattern.
During matching, the actual part of the AST that corresponds to the variable in the pattern
will be "bound" to the variable. Variables whose names that do not end with a $
("single" variables)
will be bound to exactly one AST node, whereas variables whose names end with a $
("multi" variables)
will be bound to any number of consecutive AST nodes (with the same AST node as a parent).
The actual AST nodes that were bound to single variables are available through HintContext.getVariables()
,
nodes bound to multi variables are available through HintContext.getMultiVariables()
.
For variables that represent an expression, a type constraint can be specified using the
TriggerPattern.constraints()
attribute.
All classes should be referred to using FQNs.public abstract ConstraintVariableType[] constraints
pattern
.