Module jp.ecuacion.lib.core
Annotation Interface ConditionalEmpty
@Target(TYPE)
@Retention(RUNTIME)
@Repeatable(ConditionalEmptyList.class)
@Documented
@Constraint(validatedBy=ConditionalEmptyValidator.class)
public @interface ConditionalEmpty
Checks if specified
field is empty
when conditionField has the value
which is equal to conditionValue,
or the value fieldWhichHoldsConditionalValue has.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines severalConditionalEmptyannotations on the same element. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionConditional field.Validated field. -
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.SeeconditionField.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]"
-
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:
{}
-