Interface ResultListRowTransformer<S,Q extends FlexibleRelationalPathBase<R>,R>
- Type Parameters:
S
- schema typeQ
- type of entity pathR
- row type related to theResultListRowTransformer
public interface ResultListRowTransformer<S,Q extends FlexibleRelationalPathBase<R>,R>
Helps with row transformation of result lists, possibly in stateful context.
This kind of transformation still has access to low-level row data if necessary.
Typical example is container's owner OID which is lost in the container itself.
For example, row-by-row transformation can collect information for some additional processing
which can be executed by implementing
finishTransformation()
.
Alternatively, the result list of tuples can be processed first with beforeTransformation(java.util.List<com.querydsl.core.Tuple>, Q)
,
for instance to fetch owner objects for the whole container list in a single query.
The reason for this is that transform(com.querydsl.core.Tuple, Q)
already needs to return actual containers from
the owner object.
Leaving this fetch to finishTransformation()
would require this method to transform the list
again and replace "bare" containers with the real ones from owner objects.
Finish method is useful when the objects in the final result list needs to be enriched, but not
when they need to be replaced.
(If this is necessary later, just add result list as parameter and returned value as well.)-
Method Summary
Modifier and TypeMethodDescriptiondefault void
beforeTransformation
(List<com.querydsl.core.Tuple> rowTuples, Q entityPath) This allows preprocessing of results before the transformation.default void
This method is called after all the rows were transformed and allows for additional final shake-up for more complex stateful transformations.Transforms row tuple to the midPoint object.
-
Method Details
-
beforeTransformation
default void beforeTransformation(List<com.querydsl.core.Tuple> rowTuples, Q entityPath) throws SchemaException This allows preprocessing of results before the transformation. One example is to load owner objects for containers.- Throws:
SchemaException
-
transform
Transforms row tuple to the midPoint object. -
finishTransformation
This method is called after all the rows were transformed and allows for additional final shake-up for more complex stateful transformations.- Throws:
SchemaException
-