Annotation Interface Sortable


@Target(FIELD) @Retention(RUNTIME) @Documented public @interface Sortable
Marks a field as eligible for sorting in API query requests.

Fields annotated with @Sortable may be referenced in sort query parameters when pagination is enabled via RestrictedPageable.

The annotation is applied to whichever type is used as the sorting contract: entity fields in entity-aware mode, or DTO fields in DTO-aware mode.

This annotation is purely declarative and does not impose any persistence or indexing requirements. Its sole purpose is to explicitly whitelist fields that are safe and supported for sorting at the API level.

Sorting requests targeting fields not annotated with @Sortable will be rejected during request resolution.

Example usage:


 @Entity
 public class User {

     @Sortable
     private String username;

     @Sortable
     private Instant createdAt;
 }