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 int: primitives will always have a default value (e.g. zero). If optionality is required, then use the corresponding wrapper class (e.g. java.lang.Integer) and annotate with Parameter#optionality() as required.

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.