001package io.avaje.http.api;
002
003/**
004 * Exception for parameters that are required.
005 * <p>
006 * This is primarily intended for use when populating Kotlin form beans
007 * with non-nullable properties and failing early rather than validate
008 * the entire bean.
009 */
010public class RequiredArgumentException extends IllegalArgumentException {
011
012  private String property;
013
014  /**
015   * Construct with a message and property.
016   */
017  public RequiredArgumentException(String message, String property) {
018    super(message);
019    this.property = property;
020  }
021
022  /**
023   * Construct with an exception.
024   */
025  public RequiredArgumentException(Exception e) {
026    super(e);
027  }
028
029  /**
030   * Construct with a message and exception.
031   */
032  public RequiredArgumentException(String message, Exception e) {
033    super(message, e);
034  }
035
036  /**
037   * Return the name of the property that is required.
038   */
039  public String getProperty() {
040    return property;
041  }
042
043  /**
044   * Set the name of the required property.
045   */
046  public void setProperty(String property) {
047    this.property = property;
048  }
049}