Annotation Type UniqueElements
@Documented
@Constraint(validatedBy={})
@Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE})
@Retention(RUNTIME)
@Repeatable(List.class)
public @interface UniqueElements
Validates that every object in the provided
Collection
is unique, i.e. that we can't find 2 equal elements in
the collection.
For instance, this can be useful with JAX-RS, which always deserializes collections to a list. Thus, duplicates would implicitly and silently be removed when converting it to a set. This constraint allows you to check for duplicates in the list and to raise an error instead.
- Since:
- 6.0.5
- Author:
- Tadhg Pearson
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
Defines several@UniqueElements
annotations on the same element. -
Optional Element Summary