Annotation Type NotEmptyAlternateIfOtherHasValue
@Documented
@Constraint(validatedBy=NotEmptyAlternateIfOtherHasValueValidator.class)
@Target({TYPE,ANNOTATION_TYPE})
@Retention(RUNTIME)
public @interface NotEmptyAlternateIfOtherHasValue
The annotated bean must contain at least three properties:
Supported types are beans,
- a field that has to be checked (option
field) - a field that has alternate to be checked (option
fieldAlternate) - a field which entry is compared against a value (option
fieldCompareandvalueCompare)
fieldCompare matches valueCompare, field
or alternate fieldAlternate must not be empty (null or "").Supported types are beans,
null elements are considered valid.- Author:
- Manfred Tremmel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines severalMustBeAlternateFilledIfOtherHasValueannotations on the same element. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionfield name to check.alternate field name to check.field name to compare.String[]value the compare field must have to check. -
Optional Element Summary
Optional Elements
-
Element Details
-
field
String fieldfield name to check.- Returns:
- field/path contains value to check
-
fieldAlternate
String fieldAlternatealternate field name to check.- Returns:
- field/path contains alternate value to check
-
fieldCompare
String fieldComparefield name to compare.- Returns:
- field/path contains value to compare
-
valueCompare
String[] valueComparevalue the compare field must have to check.- Returns:
- value to compare
-
-
-
message
String messagelocalized message.- Returns:
- localized validation message
- Default:
- "{de.knightsoftnet.validators.shared.NotEmptyAlternateIfOtherHasValue.message}"
-
groups
Class<?>[] groupsgroups to use.- Returns:
- array of validation groups
- Default:
- {}
-
payload
Class<? extends jakarta.validation.Payload>[] payloadpayload whatever.- Returns:
- payload class
- Default:
- {}
-