Skip to content

Commit efe93e3

Browse files
committed
Polishing.
Reuse definitive path flag without recompile the expression. See #2270
1 parent 037df8e commit efe93e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/springframework/data/web/JsonProjectingMethodInterceptorFactory.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,14 @@ public Object invoke(MethodInvocation invocation) throws Throwable {
158158
return isCollectionResult && !(nested instanceof Collection) ? result : nested;
159159
}
160160

161-
type = isCollectionResult && JsonPath.isPathDefinite(jsonPath)
161+
boolean definitePath = JsonPath.isPathDefinite(jsonPath);
162+
type = isCollectionResult && definitePath
162163
? ResolvableType.forClassWithGenerics(List.class, type)
163164
: type;
164165

165166
List<?> result = (List<?>) context.read(jsonPath, new ResolvableTypeRef(type));
166167

167-
if (isCollectionResult && JsonPath.isPathDefinite(jsonPath)) {
168+
if (isCollectionResult && definitePath) {
168169
result = (List<?>) result.get(0);
169170
}
170171

0 commit comments

Comments
 (0)