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:- a field that has to be checked (option
field) - a array of fields and entries to be compared (option
otherFieldValueMapping)
otherFieldValueMapping.fieldComparematches one of the corresponding entries inotherFieldValueMapping.valueCompare(array of possible values),fieldmust not be empty (null or "").
Supported types are beans,nullelements are considered valid. - a field that has to be checked (option
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description Stringfieldname of the field to be validated.FieldValueMapping[]otherFieldValueMappingarray of FieldValueMapping's.
-
-
-
Element Detail
-
field
String field
name of the field to be validated.- Returns:
- the name of the field to be validated
-
-
-
otherFieldValueMapping
FieldValueMapping[] otherFieldValueMapping
array of FieldValueMapping's.- Returns:
- an array of FieldValueMapping's
-
-
-
message
String message
validation message.- Returns:
- the validation message
- Default:
- "{de.knightsoftnet.validators.shared.NotEmptyIfOthersHaveValue.message}"
-
-
-
groups
Class<?>[] groups
validation groups.- Returns:
- the validation groups
- Default:
- {}
-
-
-
payload
Class<? extends javax.validation.Payload>[] payload
payload classes.- Returns:
- the payload classes
- Default:
- {}
-
-