Annotation Type 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

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Defines several @UniqueElements annotations on the same element.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<?>[]
     
     
    Class<? extends Payload>[]
     
  • Element Details

    • message

      String message
      Default:
      "{org.hibernate.validator.constraints.UniqueElements.message}"
    • groups

      Class<?>[] groups
      Default:
      {}
    • payload

      Class<? extends Payload>[] payload
      Default:
      {}