Class DTOAwareFieldResolver

java.lang.Object
in.co.akshitbansal.springwebquery.resolver.field.DTOAwareFieldResolver
All Implemented Interfaces:
FieldResolver

public class DTOAwareFieldResolver extends Object implements FieldResolver
FieldResolver implementation that treats a DTO type as the public query contract and maps DTO selector paths to entity selector paths.

Resolution proceeds in three steps:

  • Resolve the incoming path against the DTO class structure.
  • Validate the terminal DTO field via the supplied callback.
  • Translate the DTO path to an entity path using MapsTo, then verify that the resulting entity path exists.
  • Constructor Details

    • DTOAwareFieldResolver

      public DTOAwareFieldResolver()
  • Method Details

    • resolvePathAndValidateTerminalField

      public String resolvePathAndValidateTerminalField(String dtoPath, @Nullable Consumer<Field> terminalFieldValidator)
      Resolves a DTO selector path, validates its terminal DTO field, and maps the selector to the corresponding entity path.
      Specified by:
      resolvePathAndValidateTerminalField in interface FieldResolver
      Parameters:
      dtoPath - selector path from the incoming request
      terminalFieldValidator - callback used to validate the terminal DTO field; when null, terminal-field validation is skipped
      Returns:
      resolved entity path corresponding to the DTO selector