Module jp.ecuacion.lib.core
Annotation Interface ConditionalNotEmpty
@PlacedAtClass
@Target(TYPE)
@Retention(RUNTIME)
@Repeatable(ConditionalNotEmptyList.class)
@Documented
@Constraint(validatedBy=ConditionalNotEmptyValidator.class)
public @interface ConditionalNotEmpty
Checks if specified
field is not empty
only when conditionField has specified value.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines severalConditionalNotEmptyannotations on the same element. -
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]Validation check is executed only when the valueconditionFieldholds is equal to to it.booleanValidation check is executed only when it's true and the valueconditionFieldholds is empty.booleanValidation check is executed only when it's true and the valueconditionFieldholds is not empty.booleanDecides whether validation check is executed when the value ofconditionFieldis not equal to the specified value.SeeconditionField.Specifies a field which holds the display name of condition value.Class<?>[]Returns groups.Returns message ID.Class<? extends jakarta.validation.Payload>[]Returns payload.
-
Element Details
-
field
String[] fieldValidated field.- Returns:
- field name
-
conditionField
String conditionFieldConditional field. Validation check is executed only when the value of this field is equal to the value whichfieldWhichHoldsConditionalValueholds.- Returns:
- condition field name
-
conditionValue
String[] conditionValueValidation check is executed only when the valueconditionFieldholds is equal to to it.You can use this value when the datatype of
conditionFieldisString. Otherwise you should usefieldWhichHoldsConditionalValue.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 conditionValueIsEmptyValidation check is executed only when it's true and the valueconditionFieldholds is empty.- Returns:
- boolean
- Default:
false
-
conditionValueIsNotEmpty
boolean conditionValueIsNotEmptyValidation check is executed only when it's true and the valueconditionFieldholds is not empty.- Returns:
- boolean
- Default:
false
-
fieldHoldingConditionValue
String fieldHoldingConditionValueSeeconditionField.Originally The datatype of a parameter of annotation can only be String and primitive datatypes. It cannot be
Object.- Returns:
- value
- Default:
"[null]"
-
emptyForOtherValues
boolean emptyForOtherValuesDecides whether validation check is executed when the value ofconditionFieldis not equal to the specified value.- Returns:
- boolean
- Default:
false
-
fieldHoldingConditionValueDisplayName
String fieldHoldingConditionValueDisplayNameSpecifies 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 messageReturns message ID.- Returns:
- message ID
- Default:
"{jp.ecuacion.validation.constraints.ConditionalNotEmpty.message}"
-
groups
Class<?>[] groupsReturns groups.- Returns:
- groups
- Default:
{}
-
payload
Class<? extends jakarta.validation.Payload>[] payloadReturns payload.- Returns:
- payload
- Default:
{}
-