anchor.diff:  }
   ----
   
  +.Kotlin
  +[source,kotlin,role="secondary"]
  +----
  +class SingleOptionValidationExample {
  +    private var prime = 0
  +
  +    @Spec lateinit var spec : CommandSpec // injected by picocli
  +
  +    @Option(names = ["-p", "--prime"], paramLabel = "NUMBER")
  +    fun setPrimeNumber(value: Int) {
  +        var invalid = false
  +        for (i in 2..value / 2) {
  +            if (value % i == 0) {
  +                invalid = true
  +                break
  +            }
  +        }
  +        if (invalid) {
  +            throw ParameterException(spec.commandLine(),
  +                String.format("Invalid value '%s' for option '--prime': " +
  +                              "value is not a prime number.", value))
  +        }
  +        prime = value
  +    }
  +    // ...
  +}
  +----
  +
   ==== Validating Option Combinations
   Another common scenario is that the combination of multiple options and positional parameters is valid.
   One way to accomplish this is to perform such validation at the beginning of the business logic.
   
   The following example validates that at least one of the `--xml`, `--csv`, or `--json` options is specified:
   
  -[source,java]
  +.Java
  +[source,java,role="primary"]
   ----
   @Command(name = "myapp", mixinStandardHelpOptions = true, version = "myapp 0.1")
   class MultiOptionValidationExample implements Runnable {
  
positive.code: 
  The picocli wiki has a https://github.com/remkop/picocli/wiki/JSR-380-BeanValidation[full example], below is a snippet:
  
  [source,java]
  ----
  import picocli.CommandLine;
  import picocli.CommandLine.Model.CommandSpec;
  
negative.code: import javax.validation.Validation;
  import javax.validation.Validator;
  import javax.validation.constraints.*;
  import java.util.Set;
  
  // Example inspired by https://www.baeldung.com/javax-validation
  