Annotation Type LevenshteinDistance
-
@Documented @Constraint(validatedBy=LevenshteinDistanceValidator.class) @Target({TYPE,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface LevenshteinDistance
The annotated bean must contain exact three properties:- a field that has to be checked (option
field1) - a field which entry is compared (option
field2) - the minimum levenshtein distance both field entries must have (option
minDistance) - add the error to field1 (option
addErrorToField1, default true) - add the error to field2 (option
addErrorToField2, default true)
fieldCompareandfieldis calculated, it must be equal or greater then the value of minDistance. not be empty (null or "").
Supported types are beans,nullelements are considered valid.- Author:
- Valentin Pricop
- a field that has to be checked (option
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description Stringfield1field1 name to compare.Stringfield2field2 name to compare.intminDistanceminimum levenshtein distance.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanaddErrorToField1add error to field1 (default true).booleanaddErrorToField2add error to field2 (default true).Class<?>[]groupsgroups to use.Stringmessagelocalized message.Class<? extends javax.validation.Payload>[]payloadpayload whatever.
-
-
-
Element Detail
-
field1
String field1
field1 name to compare.- Returns:
- field/path contains value to compare
-
-
-
field2
String field2
field2 name to compare.- Returns:
- field/path contains value to compare
-
-
-
message
String message
localized message.- Returns:
- localized validation message
- Default:
- "{de.knightsoftnet.validators.shared.LevenshteinDistance.message}"
-
-
-
groups
Class<?>[] groups
groups to use.- Returns:
- array of validation groups
- Default:
- {}
-
-
-
payload
Class<? extends javax.validation.Payload>[] payload
payload whatever.- Returns:
- payload class
- Default:
- {}
-
-