Class ValidationAppException

All Implemented Interfaces:
Serializable

public class ValidationAppException extends SingleAppException
Holds a Jakarta Validations violation.
See Also:
  • Constructor Details

    • ValidationAppException

      public ValidationAppException(@RequireNonnull jakarta.validation.ConstraintViolation<?> violation)
      Constructs a new instance with Jakarta Validation violation.
      Parameters:
      violation - violation result
    • ValidationAppException

      public ValidationAppException(@RequireNonnull ConstraintViolationBean bean)
      Constructs a new instance with BeanValidationErrorInfoBean.

      This makes possible to treat exceptions which are not created from ConstraintViolation as BeanValidationAppException.

      Parameters:
      bean - BeanValidationErrorInfoBean
  • Method Details

    • getConstraintViolationBean

      public ConstraintViolationBean getConstraintViolationBean()
      Gets BeanValidationErrorInfoBean.
      Returns:
      BeanValidationErrorInfoBean
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable
    • toString

      @Nonnull public String toString()
      Outputs a string for logs.
      Overrides:
      toString in class Throwable
      Returns:
      String
    • isMessageWithItemName

      public boolean isMessageWithItemName()
      Obtains isMessageWithItemName.
      Returns:
      boolean
    • setMessageWithItemName

      public ValidationAppException setMessageWithItemName(boolean isMessageWithItemName)
      Sets isMessageWithItemName and returns this for method chain.
      Returns:
      BeanValidationErrorInfoBean;
    • getMessagePrefix

      public PropertyFileUtil.Arg getMessagePrefix()
    • setMessagePrefix

      public ValidationAppException setMessagePrefix(PropertyFileUtil.Arg messagePrefix)
      Sets messagePrefix and returns this for method chain.
      Returns:
      BeanValidationErrorInfoBean;
    • getMessagePostfix

      public PropertyFileUtil.Arg getMessagePostfix()
      Sets messagePostfix and returns this for method chain.
      Returns:
      BeanValidationErrorInfoBean;
    • setMessagePostfix

      public void setMessagePostfix(PropertyFileUtil.Arg messagePostfix)
    • getItemPropertyPaths

      public String[] getItemPropertyPaths()
      Description copied from class: SingleAppException
      Provides the location of an item at which this error occurred.

      Its data-type is an array because although standard jakarta validation (like @NotEmpty has only one property path, but BizLogicAppException which describes an error of some relation between multiple items may have multiple property paths.

      Specified by:
      getItemPropertyPaths in class SingleAppException
      Returns:
      an array of propertyPath