Annotation Interface MapsTo


@Target(FIELD) @Retention(RUNTIME) @Documented public @interface MapsTo
Declares the entity-side property segment that a DTO field maps to for filtering and sorting path translation.

When DTO-aware query resolution is enabled, each path segment is resolved on the DTO class and then translated to an entity path using this annotation. If absent, the DTO field name itself is used as the entity segment.

Example:


 class UserDto {
   @MapsTo(field = "profile")
   private ProfileDto details;

   class ProfileDto {
     @MapsTo(field = "displayName")
     private String name;
   }
 }
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Entity-side field or path segment to use for this DTO field.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether this mapping starts a new absolute path from the entity root.
  • Element Details

    • field

      String field
      Entity-side field or path segment to use for this DTO field.
      Returns:
      mapped entity path segment
    • absolute

      boolean absolute
      Whether this mapping starts a new absolute path from the entity root.

      When true, previously accumulated parent segments are discarded before this segment is applied.

      Returns:
      true to reset parent segments, otherwise false
      Default:
      false