Class MetadataQuerydslProjectionBuilder
java.lang.Object
nl.datasteel.crudcraft.projection.impl.querydsl.MetadataQuerydslProjectionBuilder
- All Implemented Interfaces:
QuerydslProjectionBuilder
QuerydslProjectionBuilder
that relies on ProjectionMetadata
.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a MetadataQuerydslProjectionBuilder with the given registry.MetadataQuerydslProjectionBuilder
(ProjectionMetadataRegistry registry, ProjectionMapper mapper) Constructs a MetadataQuerydslProjectionBuilder with the given registry and mapper. -
Method Summary
Modifier and TypeMethodDescription<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.<D> com.querydsl.core.types.Expression
<D> Constructs a QueryDSL expression for projecting entity data into a DTO.
-
Constructor Details
-
MetadataQuerydslProjectionBuilder
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 metadatamapper
- 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 interfaceQuerydslProjectionBuilder
- Type Parameters:
T
- the type of the entityD
- the type of the DTO- Parameters:
queryFactory
- the JPAQueryFactory to use for executing the queryentityType
- the type of the entity to project fromdtoType
- the type of the DTO to project intoquery
- 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 interfaceQuerydslProjectionBuilder
- Type Parameters:
D
- the type of the DTO- Parameters:
from
- the PathBuilder representing the entity to project fromdtoType
- the type of the DTO to project into- Returns:
- an Expression that can be used in a QueryDSL query
-