Class ProjectionMapper

java.lang.Object
nl.datasteel.crudcraft.projection.mapping.ProjectionMapper

public class ProjectionMapper extends Object
Maps DTO classes to entity paths at runtime using reflection. When no compile-time ProjectionMetadata is available this mapper constructs the necessary projection expressions based on field names and ProjectionField annotations.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a ProjectionMapper using the default field resolver.
    Constructs a ProjectionMapper with a custom field resolver.
  • Method Summary

    Modifier and Type
    Method
    Description
    <D> com.querydsl.core.types.Expression<D>
    construct(com.querydsl.core.types.dsl.PathBuilder<?> from, Class<D> dtoType)
    Construct a Querydsl expression for the given DTO type.
    <D> jakarta.persistence.criteria.Selection<D>
    construct(jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.From<?,?> from, Class<D> dtoType)
    Construct a JPA Criteria selection for the given DTO type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProjectionMapper

      public ProjectionMapper()
      Constructs a ProjectionMapper using the default field resolver. This resolver uses reflection to map DTO fields to entity attributes. This constructor is useful when no compile-time metadata is available, allowing for dynamic projection mapping at runtime.
    • ProjectionMapper

      public ProjectionMapper(ProjectionFieldResolver fieldResolver)
      Constructs a ProjectionMapper with a custom field resolver. This allows for custom resolution logic if needed.
      Parameters:
      fieldResolver - the resolver to use for mapping fields
  • Method Details

    • construct

      public <D> jakarta.persistence.criteria.Selection<D> construct(jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.From<?,?> from, Class<D> dtoType)
      Construct a JPA Criteria selection for the given DTO type.
    • construct

      public <D> com.querydsl.core.types.Expression<D> construct(com.querydsl.core.types.dsl.PathBuilder<?> from, Class<D> dtoType)
      Construct a Querydsl expression for the given DTO type.