Skip to content

Commit b84d603

Browse files
committed
Polishing.
See #3160
1 parent 96621b3 commit b84d603

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;
@@ -226,8 +225,8 @@ private static final class ReturnedClass extends ReturnedType {
226225

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

229-
private final Lazy<Boolean> isDto;
230228
private final Class<?> type;
229+
private final boolean isDto;
231230
private final List<String> inputProperties;
232231

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

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

@@ -305,7 +303,7 @@ private List<String> detectConstructorParameterNames(Class<?> type) {
305303
}
306304

307305
private boolean isDto() {
308-
return isDto.get();
306+
return isDto;
309307
}
310308

311309
private boolean isDomainSubtype() {

0 commit comments

Comments
 (0)