The @ExclusiveOptionals annotation can only be used on types that are used as a @ParameterGroup (see Parameters for details).
Example
@ExclusiveOptionals
public class ExclusiveOptionalsExample {
@Parameter
private String requiredParameter;
@Parameter
@Optional
private String optionalParameter;
@Parameter
@Optional
private String anotherOptionalParameter;
}
As the name of the annotation implies, the exclusivity restriction only applies to the optional parameters. So, setting requiredParameter at the same time as optionalParameter or anotherOptionalParameter is allowed, but setting optionalParameter and anotherOptionalParameter at the same time causes an error to be thrown.
Tip: You can have as many parameters as you want inside an object that is annotated with @ExclusiveOptionals, but only one optional parameter is allowed to be set at any time.