Annotation Interface ConditionalEmpty
field is empty
only when conditionField has specified value.
There are 4 ways to specify the value of conditionField.
conditionValue: You can set the specified value directly toconditionValueparameter. This can be used only when the datatype ofconditionFieldis String.conditionValueIsEmpty: You can settrueto this parameter means that the value ofconditionFieldis empty.conditionValueIsNotEmpty: You can settrueto this parameter means that the value ofconditionFieldis not empty.fieldHoldingConditionValue: You can set the field name to this parameter means that the value offieldHoldingConditionValueis the specified value.
(the datatype offieldHoldingConditionValueis always an array)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines severalConditionalEmptyannotations on the same element. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionSpecifies how to determine condition is valid.Conditional field.String[]Validated field. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionSpecifies the operator applied between the value of a condition field and the condition value To decide whether the condition is satisfied.Specifies condition value field.String[]Specifies condition value string.Class<?>[]Returns groups.Returns message ID.booleanDecides whether validation check is executed when the value ofconditionFieldis not equal to the specified value.Class<? extends jakarta.validation.Payload>[]Returns payload.Specifies a field which holds the display name of condition value.
-
Element Details
-
propertyPath
String[] propertyPathValidated field.Its name is
propertyPath, notfieldbecause basically you set field names (like 'name'), but you can also set a field in a bean (like 'dept.name').- Returns:
- propertyPath
-
conditionPropertyPath
String conditionPropertyPathConditional field. Validation check is executed only when the value of this field is equal to the value whichfieldWhichHoldsConditionalValueholds.Its name is
conditionPropertyPath, notconditionFieldbecause 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
ConditionValuePattern conditionPatternSpecifies 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
-
conditionOperator
ConditionOperator conditionOperatorSpecifies the operator applied between the value of a condition field and the condition value To decide whether the condition is satisfied.- Returns:
- ConditionOperator
- Default:
equalTo
-
conditionValueString
String[] conditionValueStringSpecifies condition value string.This is used when
HowToDetermineConditionIsValidis eitherstringValueOfConditionFieldIsEqualToorstringValueOfConditionFieldIsNotEqualTo. Otherwise it must be unset.When
stringValueOfConditionFieldIsEqualTois selected, a condition is considered to be satisfied if one of the values of this field is equal to the value of conditionField.
WhenstringValueOfConditionFieldIsNotEqualTois 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
stringValueOfConditionFieldIsEqualToandstringValueOfConditionFieldIsNotEqualToonly when the datatype of conditionField is string. Otherwise you need to choose other choice.- Returns:
- an array of string values
- Default:
{"[null]"}
-
conditionValuePropertyPath
String conditionValuePropertyPathSpecifies condition value field.This is used when
HowToDetermineConditionIsValidis eithervalueOfConditionFieldIsEqualToValueOforvalueOfConditionFieldIsNotEqualToValueOf. Otherwise it must be unset.The datatype of the field specifies
conditionValueFieldcan be an array.When
valueOfConditionFieldIsEqualToValueOfis selected, a condition is considered to be satisfied if one of the values of the fieldconditionValueFieldspecifies is equal to the value of conditionField.
WhenvalueOfConditionFieldIsNotEqualToValueOfis selected, a condition is considered to be satisfied if all of the values of the fieldconditionValueFieldspecifies is NOT equal to the value of conditionField.
Its name is
conditionValuePropertyPath, notconditionValueFieldbecause 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 valueOfConditionValuePropertyPathForDisplaySpecifies 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, notvalueOfConditionValueFieldForDisplaybecause 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 notEmptyWhenConditionNotSatisfiedDecides whether validation check is executed when the value ofconditionFieldis not equal to the specified value.- Returns:
- boolean
- Default:
false
-
message
String messageReturns message ID.- Returns:
- message ID
- Default:
"{jp.ecuacion.validation.constraints.ConditionalEmpty.message}"
-
groups
Class<?>[] groupsReturns groups.- Returns:
- groups
- Default:
{}
-
payload
Class<? extends jakarta.validation.Payload>[] payloadReturns payload.- Returns:
- payload
- Default:
{}
-