@Rule

Target: Any attribute annotated with @Parameter.

Description: Defines a specific rule to a parameter, regarding others.

JavaDoc: Click here

Attributes:

Name Description Data type Required Default value
ruleID The id of the desired rule. See bellow for the existing rules. String Yes -
parameters Comma separated parameter id list, of the parameters that are linked to this rule. String Yes -
action A optional action to perform when the rule is validated. Can be ignored and when not, always has a default conventioned behaviour. ParameterRuleAction No DEFAULT

Example:

public class aStage {

 @Parameter(defaultValue="30")
 @Rule(ruleID="exclusive", parameters="param1,param2")
 Integer myIntegerParam;

 @Parameter(constraints="numeric, maxvalue=100")
 @Rule(ruleID="dependent", parameters="myIntegerParam", action="hide", value="1")
 String myStringParam;
 ...
}

Rules:

  • exclusive: Ensures that only one of the parameter list (including the present parameter) is selected/filled on a submit.
  • dependent: Creates a dependency for the present parameter in a away that it can only be filled when the given parameter(s) is(are) selected/filled. By default is disabled if not. (can have the actions: ''hide'' or ''disabled''). Its possible to specify a value in form value=''x'' or vale=''x:y'' where x is the value and y is the description. You can also specify an interval specifying first and last value(ex:first=''X'',last=''y'' ).
  • Any other custom/third party contributed rule

See also:

Back to annotation reference