Explicit binding of constructor parameters for @ProjectionConstructor

Description

Follows up on .

Use case: define a parameter of a projection constructor as a specific inner projection either something completely different from field projections such as an identifier projection, or more precise configuration of field value/object projections.

For example:

Currently, all constructor parameters are bound implicitly, which limits users to field projections or object projections. There is no ID projection in particular, which prevents from fully loading an entity through its projection constructor, since it can’t project on the ID. This also means -parameters must be passed to the compiler when compiling projection constructors.

Core set of annotations (must be implemented):

  • @IdProjection

  • @FieldProjection

  • @ObjectProjection

    • we might want a includeDepth in here (=> moved to )

  • @ProjectionBinding(binder = ...) (for custom projection annotations)

Less useful/more challenging annotations that could be split into another ticket:

  • @ScoreProjection

  • @DistanceProjection (=> moved to )

  • @EntityProjection

  • @EntityReferenceProjection

  • @DocumentReferenceProjection

  • @HighlightProjection ( )

  • Others, see all projections available.

Some things to test in particular:

  • There should be no error if -parameters is not used when compiling, as long as all constructor parameters of a projection constructor have a @*Projection annotation (and that projection specifies the field path, if relevant).

  • There should be an error if -parameters is not used when compiling, and all constructor parameters of a projection constructor have a @*Projection annotation, but one of them is annotated with @FieldProjection or @ObjectProjection and does not specify the field path.

  • There should be an error when using two @*Projection annotations on the same constructor parameter.

  • And more (the list above is not exhaustive, obviously).

Activity

Show:
Fixed

Details

Assignee

Reporter

Components

Sprint

Fix versions

Priority

Created May 10, 2022 at 8:22 AM
Updated June 2, 2023 at 1:33 PM
Resolved May 31, 2023 at 12:46 PM