Class ProjectionMapper
java.lang.Object
nl.datasteel.crudcraft.projection.mapping.ProjectionMapper
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
ConstructorsConstructorDescriptionConstructs a ProjectionMapper using the default field resolver.ProjectionMapper
(ProjectionFieldResolver fieldResolver) Constructs a ProjectionMapper with a custom field resolver. -
Method Summary
Modifier and TypeMethodDescription<D> com.querydsl.core.types.Expression
<D> 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.
-
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
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.
-