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:
Supported types are beans,
- 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)
fieldCompare and field is
calculated, it must be equal or greater then the value of minDistance. not be empty (null or "").
Supported types are beans,
null elements are considered valid.- Author:
- Valentin Pricop
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines several@LevenshteinDistanceannotations on the same element. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionfield1 name to compare.field2 name to compare.intminimum levenshtein distance. -
Optional Element Summary
Optional Elements
-
Element Details
-
-
message
String messagelocalized message.- Returns:
- localized validation message
- Default:
- "{de.knightsoftnet.validators.shared.LevenshteinDistance.message}"
-
groups
Class<?>[] groupsgroups to use.- Returns:
- array of validation groups
- Default:
- {}
-
addErrorToField1
boolean addErrorToField1add error to field1 (default true).- Returns:
- true if error should be added to field1
- Default:
- true
-
addErrorToField2
boolean addErrorToField2add error to field2 (default true).- Returns:
- true if error should be added to field2
- Default:
- true
-
payload
Class<? extends jakarta.validation.Payload>[] payloadpayload whatever.- Returns:
- payload class
- Default:
- {}
-