Class MetadataQuerydslProjectionBuilder

java.lang.Object
nl.datasteel.crudcraft.projection.impl.querydsl.MetadataQuerydslProjectionBuilder
All Implemented Interfaces:
QuerydslProjectionBuilder

public class MetadataQuerydslProjectionBuilder extends Object implements QuerydslProjectionBuilder
  • Constructor Details

    • MetadataQuerydslProjectionBuilder

      public MetadataQuerydslProjectionBuilder(ProjectionMetadataRegistry registry)
      Constructs a MetadataQuerydslProjectionBuilder with the given registry. Uses a default ProjectionMapper for constructing expressions when metadata is not available.
      Parameters:
      registry - the ProjectionMetadataRegistry to use for accessing compile-time generated metadata
    • MetadataQuerydslProjectionBuilder

      public MetadataQuerydslProjectionBuilder(ProjectionMetadataRegistry registry, ProjectionMapper mapper)
      Constructs a MetadataQuerydslProjectionBuilder with the given registry and mapper.
      Parameters:
      registry - the ProjectionMetadataRegistry to use for accessing compile-time generated metadata
      mapper - the ProjectionMapper to use for constructing expressions when metadata is not available
  • Method Details

    • build

      public <T, D> com.querydsl.jpa.impl.JPAQuery<D> build(com.querydsl.jpa.impl.JPAQueryFactory queryFactory, Class<T> entityType, Class<D> dtoType, ProjectionQuery<T> query)
      Builds a QueryDSL query that projects entity data into a DTO.
      Specified by:
      build in interface QuerydslProjectionBuilder
      Type Parameters:
      T - the type of the entity
      D - the type of the DTO
      Parameters:
      queryFactory - the JPAQueryFactory to use for executing the query
      entityType - the type of the entity to project from
      dtoType - the type of the DTO to project into
      query - the projection query to execute
      Returns:
      a JPAQuery that can be executed to retrieve projected data
    • construct

      public <D> com.querydsl.core.types.Expression<D> construct(com.querydsl.core.types.dsl.PathBuilder<?> from, Class<D> dtoType)
      Constructs a QueryDSL expression for projecting entity data into a DTO.
      Specified by:
      construct in interface QuerydslProjectionBuilder
      Type Parameters:
      D - the type of the DTO
      Parameters:
      from - the PathBuilder representing the entity to project from
      dtoType - the type of the DTO to project into
      Returns:
      an Expression that can be used in a QueryDSL query