-
-
Notifications
You must be signed in to change notification settings - Fork 84
feat(@QueryProjection): support builder-based Q class generation #1078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
velo
merged 20 commits into
OpenFeign:master
from
Cole-SJ:feature/add-Query-Projection-Builder
Apr 18, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a5d1d05
feature: add builder properties in QueryProjection annotation
Cole-SJ f31f849
feature: add builder properties in Constructor class
Cole-SJ be13c36
feature: add public static inner class write methods
Cole-SJ 3bcf85d
feature: add QueryProjection Builder feature on annotation processor
Cole-SJ bfa028e
feature: add inner builder class and factory method to generated QClass
Cole-SJ 031fe37
test: add QueryProjectionBuilderTestEntity for test
Cole-SJ 60e7b97
feature, test: add QueryProjectionBuilderTestEntity for GenericExporter
Cole-SJ c8faeba
question: how can i resolve binary incompatible change without this c…
Cole-SJ da057c4
feature: add duplicate builder name check in TypeElementHandler
Cole-SJ ae5918b
docs: update javadoc for QueryProjection
Cole-SJ 7a8a09f
feature: enhance builder name validation in TypeElementHandler
Cole-SJ cc32001
Merge branch 'master' into feature/add-Query-Projection-Builder
Cole-SJ bbd4fb4
test: add unit tests for QueryProjectionBuilder
Cole-SJ 9d1bea4
Merge remote-tracking branch 'origin/feature/add-Query-Projection-Bui…
Cole-SJ 44afaab
Merge branch 'master' into feature/add-Query-Projection-Builder
Cole-SJ 7f9b0b5
Merge branch 'master' into feature/add-Query-Projection-Builder
Cole-SJ ef90954
Skip API validation on tooling projects
velo d6ff231
Merge branch 'master' into feature/add-Query-Projection-Builder
Cole-SJ 1438ef6
modify: remove inner class, methods binary compatibility validation b…
Cole-SJ ffb7dac
Merge branch 'master' into feature/add-Query-Projection-Builder
Cole-SJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ooling/querydsl-apt/src/test/java/com/querydsl/apt/domain/QueryProjectionBuilderTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package com.querydsl.apt.domain; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
| import static org.junit.Assert.assertNotNull; | ||
|
|
||
| import com.querydsl.core.types.dsl.Expressions; | ||
| import org.junit.Test; | ||
|
|
||
| public class QueryProjectionBuilderTest { | ||
|
|
||
| @Test | ||
| public void builder_buildsQClassCorrectly() { | ||
| var property = Expressions.stringPath("x"); | ||
| QQueryProjectionBuilderTestEntity dto = | ||
| QQueryProjectionBuilderTestEntity.builderTest1().setProperty(property).build(); | ||
|
|
||
| assertNotNull(dto); | ||
| assertEquals(QueryProjectionBuilderTestEntity.class, dto.getType()); | ||
| } | ||
|
|
||
| @Test | ||
| public void builder_buildsQClassCorrectly2() { | ||
| var property = Expressions.stringPath("x"); | ||
| var intProperty = Expressions.numberPath(Integer.class, "y"); | ||
| QQueryProjectionBuilderTestEntity dto = | ||
| QQueryProjectionBuilderTestEntity.builderTest2() | ||
| .setProperty(property) | ||
| .setIntProperty(intProperty) | ||
| .build(); | ||
|
|
||
| assertNotNull(dto); | ||
| assertEquals(QueryProjectionBuilderTestEntity.class, dto.getType()); | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
.../querydsl-apt/src/test/java/com/querydsl/apt/domain/QueryProjectionBuilderTestEntity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.querydsl.apt.domain; | ||
|
|
||
| import com.querydsl.core.annotations.QueryProjection; | ||
|
|
||
| public class QueryProjectionBuilderTestEntity { | ||
| private String property; | ||
| private int intProperty; | ||
| private Test test; | ||
|
|
||
| @QueryProjection(useBuilder = true, builderName = "Test1") | ||
| public QueryProjectionBuilderTestEntity(String property) { | ||
| this.property = property; | ||
| } | ||
|
|
||
| @QueryProjection(useBuilder = true, builderName = "Test2") | ||
| public QueryProjectionBuilderTestEntity(String property, int intProperty) { | ||
| this.property = property; | ||
| this.intProperty = intProperty; | ||
| } | ||
|
|
||
| @QueryProjection(useBuilder = true, builderName = "Test3") | ||
| public QueryProjectionBuilderTestEntity(String property, int intProperty, Test test) { | ||
| this.property = property; | ||
| this.intProperty = intProperty; | ||
| this.test = test; | ||
| } | ||
|
|
||
| public static class Test { | ||
| private String property; | ||
| private int intProperty; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.