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

    • propertyPath

      String[] propertyPath
      Validated field.

      Its name is propertyPath, not field because basically you set field names (like 'name'), but you can also set a field in a bean (like 'dept.name').

      Returns:
      propertyPath
    • conditionPropertyPath

      String conditionPropertyPath
      Conditional field. Validation check is executed only when the value of this field is equal to the value which fieldWhichHoldsConditionalValue holds.

      Its name is conditionPropertyPath, not conditionField because basically you set field names (like 'name'), but you can also set a field in a bean (like 'dept.name').

      Returns:
      condition field name
    • conditionPattern

      ConditionPattern conditionPattern
      Specifies how to determine condition is valid.

      For example, we can say condition is satisfied when the value of conditionField is not empty, or the value of conditionField is equal to "a".
      This field specifies how to determine that the condition is satisfied.

      Returns:
      ConditionPattern
    • conditionValueString

      String[] conditionValueString
      Specifies condition value string.

      This is used when HowToDetermineConditionIsValid is either stringValueOfConditionFieldIsEqualTo or stringValueOfConditionFieldIsNotEqualTo. Otherwise it must be unset.

      When stringValueOfConditionFieldIsEqualTo is selected, a condition is considered to be satisfied if one of the values of this field is equal to the value of conditionField.
      When stringValueOfConditionFieldIsNotEqualTo is selected, a condition is considered to be satisfied if all of the values of this field is NOT equal to the value of conditionField.

      You can use stringValueOfConditionFieldIsEqualTo and stringValueOfConditionFieldIsNotEqualTo only when the datatype of conditionField is string. Otherwise you need to choose other choice.

      Returns:
      an array of string values
      Default:
      {"[null]"}
    • conditionValuePropertyPath

      String conditionValuePropertyPath
      Specifies condition value field.

      This is used when HowToDetermineConditionIsValid is either valueOfConditionFieldIsEqualToValueOf or valueOfConditionFieldIsNotEqualToValueOf. Otherwise it must be unset.

      The datatype of the field specifies conditionValueField can be an array.

      When valueOfConditionFieldIsEqualToValueOf is selected, a condition is considered to be satisfied if one of the values of the field conditionValueField specifies is equal to the value of conditionField.
      When valueOfConditionFieldIsNotEqualToValueOf is selected, a condition is considered to be satisfied if all of the values of the field conditionValueField specifies is NOT equal to the value of conditionField.

      Its name is conditionValuePropertyPath, not conditionValueField because basically you set field names (like 'name'), but you can also set a field in a bean (like 'dept.name').

      Returns:
      an array of string values
      Default:
      "[null]"
    • valueOfConditionValuePropertyPathForDisplay

      String valueOfConditionValuePropertyPathForDisplay
      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.

      Its name is valueOfConditionValuePropertyPathForDisplay, not valueOfConditionValueFieldForDisplay because basically you set field names (like 'name'), but you can also set a field in a bean (like 'dept.name').

      Returns:
      String
      Default:
      ""
    • notEmptyWhenConditionNotSatisfied

      boolean notEmptyWhenConditionNotSatisfied
      Decides whether validation check is executed when the value of conditionField is not equal to the specified value.
      Returns:
      boolean
      Default:
      false
    • 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:
      {}