anchor.diff:  }
   ----
   
  -
  +.Kotlin
  +[source,kotlin,role="secondary"]
  +----
  +import picocli.CommandLine
  +import picocli.CommandLine.Model.CommandSpec
  +import picocli.CommandLine.*
  +
  +import javax.validation.ConstraintViolation
  +import javax.validation.Validation
  +import javax.validation.Validator
  +import javax.validation.constraints.*
  +
  +// Example inspired by https://www.baeldung.com/javax-validation
  +class User : Runnable {
  +
  +    @NotNull(message = "Name cannot be null")
  +    @CommandLine.Option(names = ["-n", "--name"], description = ["mandatory"])
  +    private lateinit var name: String
  +
  +    @Min(value = 18, message = "Age should not be less than 18")
  +    @Max(value = 150, message = "Age should not be greater than 150")
  +    @Option(names = ["-a", "--age"], description = ["between 18-150"])
  +    private var age = 0
  +
  +    @Email(message = "Email should be valid")
  +    @Option(names = ["-e", "--email"], description = ["valid email"])
  +    private lateinit var email: String
  +
  +    @Spec
  +    lateinit var spec: CommandSpec
  +    override fun toString(): String {
  +        return "User{name=$name, age=$age, email=$email}"
  +    }
  +
  +    override fun run() {
  +        validate()
  +
  +        // remaining business logic here
  +    }
  +
  +    private fun validate() {
  +        val validator: Validator = Validation.buildDefaultValidatorFactory().validator
  +        val violations: Set<ConstraintViolation<User>> = validator.validate(this)
  +        if (violations.isNotEmpty()) {
  +            var errorMsg = ""
  +            for (violation in violations) {
  +                errorMsg += "ERROR: ${violation.message}\n"
  +            }
  +            throw CommandLine.ParameterException(spec.commandLine(), errorMsg)
  +        }
  +    }
  +}
  +
  +fun main(args: Array<String>) {
  +    CommandLine(User()).execute(*args)
  +}
  +----
   
   == Parser Configuration
   
  
positive.code: 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
  
negative.code: 
  The picocli wiki has a https://github.com/remkop/picocli/wiki/JSR-380-BeanValidation[full example], below is a snippet:
  
  .Java
  [source,java,role="primary"]
  ----
  import picocli.CommandLine;
  import picocli.CommandLine.Model.CommandSpec;
  