Top Description Inners Methods
org.hibernate.validator.constraints

public @Interface UniqueElements

extends Annotation
Annotations
@Documented
@Constraint
validatedBy:
@Target:METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE
@Retention:RUNTIME
@Repeatable:List
Static Imports
java.lang.annotation.ElementType.ANNOTATION_TYPE, .ElementType.CONSTRUCTOR, .ElementType.FIELD, .ElementType.METHOD, .ElementType.PARAMETER, .ElementType.TYPE, .ElementType.TYPE_USE, .RetentionPolicy.RUNTIME

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.

Author
Tadhg Pearson
Since
6.0.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static @interface
UniqueElements.List

Defines several @UniqueElements annotations on the same element.

Method Summary

Modifier and TypeMethod and Description
public Class<?>[]
public String
public Class<? extends Payload>[]
Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

groupsback to summary
public Class<?>[] groups()
messageback to summary
public String message()
payloadback to summary
public Class<? extends Payload>[] payload()
org.hibernate.validator.constraints back to summary

public @Interface UniqueElements.List

extends Annotation
Annotations
@Target:TYPE
@Retention:RUNTIME
@Documented

Defines several @UniqueElements annotations on the same element.

Method Summary

Modifier and TypeMethod and Description
public UniqueElements[]
Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public UniqueElements[] value()