Polishing.

Reuse definitive path flag without recompile the expression.

See #2270
This commit is contained in:
Mark Paluch
2021-01-12 15:47:00 +01:00
parent 037df8e3ae
commit efe93e31b1

View File

@@ -158,13 +158,14 @@ public class JsonProjectingMethodInterceptorFactory implements MethodInterceptor
return isCollectionResult && !(nested instanceof Collection) ? result : nested;
}
type = isCollectionResult && JsonPath.isPathDefinite(jsonPath)
boolean definitePath = JsonPath.isPathDefinite(jsonPath);
type = isCollectionResult && definitePath
? ResolvableType.forClassWithGenerics(List.class, type)
: type;
List<?> result = (List<?>) context.read(jsonPath, new ResolvableTypeRef(type));
if (isCollectionResult && JsonPath.isPathDefinite(jsonPath)) {
if (isCollectionResult && definitePath) {
result = (List<?>) result.get(0);
}