Class ConstraintViolationBean

java.lang.Object
jp.ecuacion.lib.core.util.ReflectionUtil
jp.ecuacion.lib.core.jakartavalidation.bean.ConstraintViolationBean

public class ConstraintViolationBean extends ReflectionUtil
Stores ConstraintViolation info.

The reason of the existence of the class is that the violations which are not created by Jakarata Validation can also be treated just like the one created by Jakarata Validation.

  • Constructor Details

    • ConstraintViolationBean

      public ConstraintViolationBean(Object rootBean, String message, String validatorClass, String rootRecordNameForForm, String itemPropertyPath)
      Constructs a new instance with parameters, not a ConstraintViolation.

      This is used for NotEmpty validation logic.

    • ConstraintViolationBean

      public ConstraintViolationBean(jakarta.validation.ConstraintViolation<?> cv)
      Constructs a new instance with ConstraintViolation.
      Parameters:
      cv - ConstraintViolation
  • Method Details

    • getItemDependentValues

      public static void getItemDependentValues(List<ConstraintViolationBean.FieldInfoBean> beanList, Object rootBean, Object leafBean, String rootRecordNameForForm)
      Gets item dependent values.
    • getItemDependentValues

      public static ConstraintViolationBean.FieldInfoBean getItemDependentValues(String fullPropertyPath, Class<?> leafBeanClass, Object rootBean, String rootRecordNameForForm)
      Sets itemNameKey and showsValue.

      It does not consider @ItemNameKeyClass. In order to consider it, getRootRecordNameConsideringItemNameKeyClass(itemPropertyPath) needs to be used together.

      Parameters:
      fullPropertyPath - itemPropertyPath
      Returns:
      itemNameKey
    • getRootBean

      public Object getRootBean()
    • getLeafBean

      public Object getLeafBean()
    • getOriginalMessage

      public String getOriginalMessage()
      Gets message created by jakarta validation.

      DO NOT USE for user interface. Use the message obtained by ExceptionUtil instead.

      Returns:
      original message
    • getValidatorClass

      public String getValidatorClass()
    • getInvalidValue

      public String getInvalidValue()
    • getMessageId

      @Nonnull public String getMessageId()
    • getRootRecordNameForForm

      public String getRootRecordNameForForm()
    • getFieldInfoBeanList

      public List<ConstraintViolationBean.FieldInfoBean> getFieldInfoBeanList()
    • getFieldInfoBeans

      public ConstraintViolationBean.FieldInfoBean[] getFieldInfoBeans()
    • getParamMap

      @Nonnull public Map<String,Object> getParamMap()
    • getMessageParameterSet

      public Set<ConstraintViolationBean.LocalizedMessageParameter> getMessageParameterSet()