Mandatory vs Optional
By default, the framework assumes that all parameters of an action are required (mandatory). The optionality() element allows this to be relaxed.
|
The attribute has no meaning for a primitive type such as |
The values for the attribute are simply OPTIONAL or MANDATORY.
For example:
public class Customer {
public Order placeOrder(
final Product product,
final int quantity,
@Parameter(optionality = Optionality.OPTIONAL)
final String specialInstructions) {
...
}
...
}
Alternatives
It is also possible to specify optionality using @Nullable annotation.