Skip to content

Commit f065f40

Browse files
committed
Polishing.
See #3160
1 parent 15afbff commit f065f40

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/main/java/org/springframework/data/repository/query/ReturnedType.java

+10-12
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.springframework.data.mapping.model.PreferredConstructorDiscoverer;
3030
import org.springframework.data.projection.ProjectionFactory;
3131
import org.springframework.data.projection.ProjectionInformation;
32-
import org.springframework.data.util.Lazy;
3332
import org.springframework.lang.NonNull;
3433
import org.springframework.lang.Nullable;
3534
import org.springframework.util.Assert;
@@ -227,8 +226,8 @@ private static final class ReturnedClass extends ReturnedType {
227226

228227
private static final Set<Class<?>> VOID_TYPES = new HashSet<>(Arrays.asList(Void.class, void.class));
229228

230-
private final Lazy<Boolean> isDto;
231229
private final Class<?> type;
230+
private final boolean isDto;
232231
private final List<String> inputProperties;
233232

234233
/**
@@ -246,15 +245,14 @@ public ReturnedClass(Class<?> returnedType, Class<?> domainType) {
246245
Assert.isTrue(!returnedType.isInterface(), "Returned type must not be an interface");
247246

248247
this.type = returnedType;
249-
this.isDto = Lazy.of(() ->
250-
!Object.class.equals(type) && //
251-
!type.isEnum() && //
252-
!isDomainSubtype() && //
253-
!isPrimitiveOrWrapper() && //
254-
!Number.class.isAssignableFrom(type) && //
255-
!VOID_TYPES.contains(type) && //
256-
!type.getPackage().getName().startsWith("java.")
257-
);
248+
this.isDto = !Object.class.equals(type) && //
249+
!type.isEnum() && //
250+
!isDomainSubtype() && //
251+
!isPrimitiveOrWrapper() && //
252+
!Number.class.isAssignableFrom(type) && //
253+
!VOID_TYPES.contains(type) && //
254+
!type.getPackage().getName().startsWith("java.");
255+
258256
this.inputProperties = detectConstructorParameterNames(returnedType);
259257
}
260258

@@ -306,7 +304,7 @@ private List<String> detectConstructorParameterNames(Class<?> type) {
306304
}
307305

308306
private boolean isDto() {
309-
return isDto.get();
307+
return isDto;
310308
}
311309

312310
private boolean isDomainSubtype() {

0 commit comments

Comments
 (0)