anchor.diff:  import javax.validation.Validation;
   import javax.validation.Validator;
   import javax.validation.constraints.*;
  -import java.util.Arrays;
  -import java.util.List;
   import java.util.Set;
   
   // Example inspired by https://www.baeldung.com/javax-validation
  
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: }
  ----
  
  .Kotlin
  [source,kotlin,role="secondary"]
  ----
  @Command(name = "myapp", mixinStandardHelpOptions = true, version = ["myapp 0.1"])
  class MultiOptionValidationExample : Runnable {
      @Option(names = ["--xml"])  var xmlFiles: List<File>? = null
      @Option(names = ["--csv"])  var csvFiles: List<File>? = null
      @Option(names = ["--json"]) var jsonFiles: List<File>? = null
  
      @Spec lateinit var spec : CommandSpec // injected by picocli
  
       override fun run() {
          validate()
  
          // remaining business logic here
      }
  
      private fun validate() {
          if (missing(xmlFiles) && missing(csvFiles) && missing(jsonFiles)) {
              throw ParameterException(spec.commandLine(),
                  "Missing option: at least one of the " +
                  "'--xml', '--csv', or '--json' options must be specified.")
          }
      }
  
      private fun missing(list: List<*>?): Boolean {
          return list == null || list.isEmpty()
      }
  }
  
  fun main(args: Array<String>) {
      exitProcess(CommandLine(MultiOptionValidationExample()).execute(*args))
  }
  ----
  
  ==== JSR-380 BeanValidation
  If you want to keep your validation declarative and annotation-based, take a look at https://jcp.org/en/jsr/detail?id=380[JSR 380].
  
  