Annotation Interface Sorted


@Documented @Constraint(validatedBy=SortedValidator.class) @Target({METHOD,FIELD,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface Sorted
Validation constraint that checks elements are sorted. Applies to non-primitive arrays, collections and maps; for maps, the keys are examined. If any element is null, it is skipped.
  • Element Details

    • message

      String message
      Default:
      "Collection is not sorted"
    • groups

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

      Class<? extends jakarta.validation.Payload>[] payload
      Default:
      {}
    • comparator

      Class<? extends Comparator> comparator
      Specifies a Comparator to use. If none is specified, the natural sort ordering is used. The class must have a default constructor.
      Returns:
      comparator class
      Default:
      java.util.Comparator.class
    • strict

      boolean strict
      Configures whether the sorting should be strict, i.e., whether adjacent equal elements should be disallowed.
      Returns:
      true to disallow equal elements
      Default:
      true