|
25 | 25 | import java.util.List;
|
26 | 26 | import java.util.Optional;
|
27 | 27 | import java.util.Set;
|
| 28 | +import java.util.function.Function; |
28 | 29 |
|
29 | 30 | import org.springframework.core.annotation.AnnotatedElementUtils;
|
30 | 31 | import org.springframework.core.annotation.AnnotationUtils;
|
@@ -91,15 +92,30 @@ public class JpaQueryMethod extends QueryMethod {
|
91 | 92 | /**
|
92 | 93 | * Creates a {@link JpaQueryMethod}.
|
93 | 94 | *
|
94 |
| - * @param method must not be {@literal null} |
95 |
| - * @param metadata must not be {@literal null} |
96 |
| - * @param factory must not be {@literal null} |
97 |
| - * @param extractor must not be {@literal null} |
| 95 | + * @param method must not be {@literal null}. |
| 96 | + * @param metadata must not be {@literal null}. |
| 97 | + * @param factory must not be {@literal null}. |
| 98 | + * @param extractor must not be {@literal null}. |
98 | 99 | */
|
99 | 100 | public JpaQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
|
100 | 101 | QueryExtractor extractor) {
|
| 102 | + this(method, metadata, factory, extractor, JpaParameters::new); |
| 103 | + } |
| 104 | + |
| 105 | + /** |
| 106 | + * Creates a {@link JpaQueryMethod}. |
| 107 | + * |
| 108 | + * @param method must not be {@literal null}. |
| 109 | + * @param metadata must not be {@literal null}. |
| 110 | + * @param factory must not be {@literal null}. |
| 111 | + * @param extractor must not be {@literal null}. |
| 112 | + * @param parametersFunction function to obtain {@link JpaParameters}, must not be {@literal null}. |
| 113 | + * @since 3.5 |
| 114 | + */ |
| 115 | + public JpaQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory, |
| 116 | + QueryExtractor extractor, Function<ParametersSource, JpaParameters> parametersFunction) { |
101 | 117 |
|
102 |
| - super(method, metadata, factory); |
| 118 | + super(method, metadata, factory, parametersFunction); |
103 | 119 |
|
104 | 120 | Assert.notNull(method, "Method must not be null");
|
105 | 121 | Assert.notNull(extractor, "Query extractor must not be null");
|
@@ -413,11 +429,6 @@ private <T> T getMergedOrDefaultAnnotationValue(String attribute, Class annotati
|
413 | 429 | return targetType.cast(AnnotationUtils.getValue(annotation, attribute));
|
414 | 430 | }
|
415 | 431 |
|
416 |
| - @Override |
417 |
| - protected Parameters<?, ?> createParameters(ParametersSource parametersSource) { |
418 |
| - return new JpaParameters(parametersSource); |
419 |
| - } |
420 |
| - |
421 | 432 | @Override
|
422 | 433 | public JpaParameters getParameters() {
|
423 | 434 | return (JpaParameters) super.getParameters();
|
|
0 commit comments