15
15
*/
16
16
package org .springframework .data .neo4j .repository .query ;
17
17
18
+ import java .lang .reflect .Method ;
19
+ import java .util .List ;
20
+ import java .util .Optional ;
21
+
18
22
import org .springframework .core .MethodParameter ;
19
23
import org .springframework .core .annotation .AnnotatedElementUtils ;
20
24
import org .springframework .data .neo4j .repository .support .CypherdslStatementExecutor ;
23
27
import org .springframework .data .repository .query .Parameter ;
24
28
import org .springframework .data .repository .query .Parameters ;
25
29
import org .springframework .data .repository .query .QueryMethod ;
30
+ import org .springframework .data .util .TypeInformation ;
26
31
import org .springframework .lang .Nullable ;
27
32
import org .springframework .util .ClassUtils ;
28
33
29
- import java .lang .reflect .Method ;
30
- import java .util .List ;
31
- import java .util .Optional ;
32
-
33
34
/**
34
35
* Neo4j specific implementation of {@link QueryMethod}. It contains a custom implementation of {@link Parameter} which
35
36
* supports Neo4js specific placeholder as well as a convenient method to return either the parameters index or name
@@ -72,7 +73,8 @@ class Neo4jQueryMethod extends QueryMethod {
72
73
* @param factory must not be {@literal null}.
73
74
* @param cypherBasedProjection True if this points to a Cypher-DSL based projection.
74
75
*/
75
- Neo4jQueryMethod (Method method , RepositoryMetadata metadata , ProjectionFactory factory , boolean cypherBasedProjection ) {
76
+ Neo4jQueryMethod (Method method , RepositoryMetadata metadata , ProjectionFactory factory ,
77
+ boolean cypherBasedProjection ) {
76
78
super (method , metadata , factory );
77
79
78
80
Class <?> declaringClass = method .getDeclaringClass ();
@@ -108,25 +110,20 @@ Optional<Query> getQueryAnnotation() {
108
110
}
109
111
110
112
@ Override
111
- protected Parameters <Neo4jParameters , Neo4jParameter > createParameters (Method method ) {
112
- return new Neo4jParameters (method );
113
+ protected Parameters <Neo4jParameters , Neo4jParameter > createParameters (Method method , TypeInformation <?> domainType ) {
114
+ return new Neo4jParameters (method , domainType );
113
115
}
114
116
115
117
static class Neo4jParameters extends Parameters <Neo4jParameters , Neo4jParameter > {
116
118
117
- Neo4jParameters (Method method ) {
118
- super (method );
119
+ Neo4jParameters (Method method , TypeInformation <?> domainType ) {
120
+ super (method , it -> new Neo4jParameter ( it , domainType ) );
119
121
}
120
122
121
123
private Neo4jParameters (List <Neo4jParameter > originals ) {
122
124
super (originals );
123
125
}
124
126
125
- @ Override
126
- protected Neo4jParameter createParameter (MethodParameter parameter ) {
127
- return new Neo4jParameter (parameter );
128
- }
129
-
130
127
@ Override
131
128
protected Neo4jParameters createFrom (List <Neo4jParameter > parameters ) {
132
129
return new Neo4jParameters (parameters );
@@ -139,12 +136,13 @@ static class Neo4jParameter extends Parameter {
139
136
private static final String POSITION_PARAMETER_TEMPLATE = "$%d" ;
140
137
141
138
/**
142
- * Creates a new {@link Parameter} for the given {@link MethodParameter}.
139
+ * Creates a new {@link Parameter} for the given {@link MethodParameter} and {@link TypeInformation} .
143
140
*
144
141
* @param parameter must not be {@literal null}.
142
+ * @param domainType must not be {@literal null}.
145
143
*/
146
- Neo4jParameter (MethodParameter parameter ) {
147
- super (parameter );
144
+ Neo4jParameter (MethodParameter parameter , TypeInformation <?> domainType ) {
145
+ super (parameter , domainType );
148
146
}
149
147
150
148
public String getPlaceholder () {
0 commit comments