Annotation Interface MapsTo


@Target(FIELD) @Retention(RUNTIME) @Documented public @interface MapsTo
Declares how a DTO field contributes to the entity path derived from a DTO selector.

This annotation is consulted only while mapping selector paths from the DTO query contract to the underlying entity model. For each field in the resolved DTO path, the mapper contributes either the DTO field name itself or the value declared here.

If @MapsTo is absent, the DTO field name is reused as the corresponding entity-side segment. If @MapsTo is present, its value() is appended instead. When absolute() is true, any previously accumulated parent segments are discarded before the mapped value is appended.

Example:

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

     class ProfileDto {
         @MapsTo("displayName")
         private String name;
     }
 }

With that contract, the DTO selector details.name maps to the entity path profile.displayName.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Entity-side field segment or dotted subpath to append 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

    • value

      String value
      Entity-side field segment or dotted subpath to append for this DTO field.

      The declared value is inserted into the mapped entity path in place of the DTO field name.

      Returns:
      mapped entity field segment or subpath
    • absolute

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

      When true, previously accumulated parent segments are discarded before value() is applied.

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