Annotation Interface ConditionalEmpty


Checks if specified field is empty only when conditionField has specified value.

There are 4 ways to specify the value of conditionField.

  1. conditionValue: You can set the specified value directly to conditionValue parameter. This can be used only when the datatype of conditionField is String.
  2. conditionValueIsEmpty: You can set true to this parameter means that the value of conditionField is empty.
  3. conditionValueIsNotEmpty: You can set true to this parameter means that the value of conditionField is not empty.
  4. fieldHoldingConditionValue: You can set the field name to this parameter means that the value of fieldHoldingConditionValue is the specified value.
    (the datatype of fieldHoldingConditionValue is always an array)
  • Element Details

    • field

      String[] field
      Validated field.
      Returns:
      field name
    • conditionField

      String conditionField
      Conditional field. Validation check is executed only when the value of this field is equal to the value which fieldWhichHoldsConditionalValue holds.
      Returns:
      condition field name
    • conditionValue

      String[] conditionValue
      Validation check is executed only when the value conditionField holds is equal to to it.

      You can use this value when the datatype of conditionField is String. Otherwise you should use fieldWhichHoldsConditionalValue.

      Multiple values can be set to the parameter. In that case validation check is executed when one of the values are equal to the value of conditionField.

      Returns:
      value
      Default:
      {"[null]"}
    • conditionValueIsEmpty

      boolean conditionValueIsEmpty
      Validation check is executed only when it's true and the value conditionField holds is empty.
      Returns:
      boolean
      Default:
      false
    • conditionValueIsNotEmpty

      boolean conditionValueIsNotEmpty
      Validation check is executed only when it's true and the value conditionField holds is not empty.
      Returns:
      boolean
      Default:
      false
    • fieldHoldingConditionValue

      String fieldHoldingConditionValue
      Validation check is executed only when the value of the field specified by this parameter holds is equal to the value of conditionField.
      Returns:
      value
      Default:
      "[null]"
    • notEmptyForOtherValues

      boolean notEmptyForOtherValues
      Decides whether validation check is executed when the value of conditionField is not equal to the specified value.
      Returns:
      boolean
      Default:
      false
    • fieldHoldingConditionValueDisplayName

      String fieldHoldingConditionValueDisplayName
      Specifies a field which holds the display name of condition value.

      It can be an array datatype which has multiple values.
      When the value is new String[] {""}, the condionValue specified is displayed as a part of an error message.

      Returns:
      String
      Default:
      ""
    • message

      String message
      Returns message ID.
      Returns:
      message ID
      Default:
      "{jp.ecuacion.validation.constraints.ConditionalEmpty.message}"
    • groups

      Class<?>[] groups
      Returns groups.
      Returns:
      groups
      Default:
      {}
    • payload

      Class<? extends jakarta.validation.Payload>[] payload
      Returns payload.
      Returns:
      payload
      Default:
      {}