Annotation Type NotEmptyIfOthersHaveValue
@Constraint(validatedBy=NotEmptyIfOthersHaveValueValidator.class)
@Target({TYPE,ANNOTATION_TYPE})
@Retention(RUNTIME)
public @interface NotEmptyIfOthersHaveValue
The annotated bean must contain at least two properties:
Supported types are beans,
- a field that has to be checked (option
field) - a array of fields and entries to be compared (option
otherFieldValueMapping)
otherFieldValueMapping.fieldCompare matches one of the
corresponding entries in otherFieldValueMapping.valueCompare (array of possible
values), field must not be empty (null or "").Supported types are beans,
null elements are considered valid.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines severalNotEmptyIfOthersHaveValueannotations on the same element. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionname of the field to be validated.array of FieldValueMapping's. -
Optional Element Summary
Optional Elements
-
Element Details
-
field
String fieldname of the field to be validated.- Returns:
- the name of the field to be validated
-
otherFieldValueMapping
FieldValueMapping[] otherFieldValueMappingarray of FieldValueMapping's.- Returns:
- an array of FieldValueMapping's
-
-
-
message
String messagevalidation message.- Returns:
- the validation message
- Default:
- "{de.knightsoftnet.validators.shared.NotEmptyIfOthersHaveValue.message}"
-
groups
Class<?>[] groupsvalidation groups.- Returns:
- the validation groups
- Default:
- {}
-
minValue
double minValueoptional minimum value that the field should have.- Returns:
- the minimum value that the field should have, -Double.MAX_VALUE if not specified.
- Default:
- -1.7976931348623157E308
-
payload
Class<? extends jakarta.validation.Payload>[] payloadpayload classes.- Returns:
- the payload classes
- Default:
- {}
-