34
34
import org .springframework .aot .generate .Generated ;
35
35
import org .springframework .data .projection .ProjectionFactory ;
36
36
import org .springframework .data .repository .aot .generate .AotRepositoryFragmentMetadata .ConstructorArgument ;
37
- import org .springframework .data .repository .aot .generate .json .JSONException ;
38
- import org .springframework .data .repository .aot .generate .json .JSONObject ;
39
37
import org .springframework .data .repository .core .RepositoryInformation ;
40
38
import org .springframework .data .repository .core .support .RepositoryComposition ;
41
39
import org .springframework .data .repository .core .support .RepositoryFragment ;
@@ -59,7 +57,7 @@ class AotRepositoryBuilder {
59
57
private final AotRepositoryFragmentMetadata generationMetadata ;
60
58
61
59
private @ Nullable Consumer <AotRepositoryConstructorBuilder > constructorCustomizer ;
62
- private @ Nullable BiFunction <Method , RepositoryInformation , MethodContributor <? extends QueryMethod >> methodContributorFunction ;
60
+ private @ Nullable BiFunction <Method , RepositoryInformation , @ Nullable MethodContributor <? extends QueryMethod >> methodContributorFunction ;
63
61
private ClassCustomizer customizer ;
64
62
65
63
private AotRepositoryBuilder (RepositoryInformation repositoryInformation , ProjectionFactory projectionFactory ) {
@@ -89,7 +87,7 @@ public AotRepositoryBuilder withConstructorCustomizer(
89
87
}
90
88
91
89
public AotRepositoryBuilder withQueryMethodContributor (
92
- BiFunction <Method , RepositoryInformation , MethodContributor <? extends QueryMethod >> methodContributorFunction ) {
90
+ BiFunction <Method , RepositoryInformation , @ Nullable MethodContributor <? extends QueryMethod >> methodContributorFunction ) {
93
91
this .methodContributorFunction = methodContributorFunction ;
94
92
return this ;
95
93
}
@@ -144,11 +142,7 @@ public AotBundle build() {
144
142
AotRepositoryMetadata metadata = new AotRepositoryMetadata (repositoryInformation .getRepositoryInterface ().getName (),
145
143
"" , repositoryType , methodMetadata );
146
144
147
- try {
148
- return new AotBundle (javaFile , metadata .toJson ());
149
- } catch (JSONException e ) {
150
- throw new IllegalStateException (e );
151
- }
145
+ return new AotBundle (javaFile , metadata .toJson ());
152
146
}
153
147
154
148
private void contributeMethod (Method method , RepositoryComposition repositoryComposition ,
@@ -218,7 +212,7 @@ private String typeName() {
218
212
public Map <String , TypeName > getAutowireFields () {
219
213
Map <String , TypeName > autowireFields = new LinkedHashMap <>(generationMetadata .getConstructorArguments ().size ());
220
214
for (Map .Entry <String , ConstructorArgument > entry : generationMetadata .getConstructorArguments ().entrySet ()) {
221
- autowireFields .put (entry .getKey (), entry .getValue ().getTypeName ());
215
+ autowireFields .put (entry .getKey (), entry .getValue ().typeName ());
222
216
}
223
217
return autowireFields ;
224
218
}
0 commit comments