Annotation Interface RestrictedPageable


@Target(PARAMETER) @Retention(RUNTIME) @Documented public @interface RestrictedPageable
Marks a Pageable controller method parameter as subject to field-level sorting restrictions.

When applied, the pageable argument is validated so that sorting is only allowed on entity fields explicitly annotated with Sortable.

This annotation does not affect pagination parameters such as page number or page size. It only governs which fields may be used in sort query parameters.

The validation is enforced by a custom HandlerMethodArgumentResolver before the controller method is invoked.

Example usage:


 @GetMapping
 public Page<User> search(
     @RestrictedPageable(entityClass = User.class) Pageable pageable
 ) {
     ...
 }
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Entity class whose fields define the set of properties that may be used for sorting.
  • Element Details

    • entityClass

      Class<?> entityClass
      Entity class whose fields define the set of properties that may be used for sorting.

      Only fields annotated with Sortable on this entity are permitted in the sort request parameter.

      Returns:
      the entity class used for sort validation