mirror of
https://github.com/spring-projects/spring-data-commons.git
synced 2026-05-03 03:34:35 +01:00
@@ -29,7 +29,6 @@ import org.springframework.data.mapping.PreferredConstructor;
|
||||
import org.springframework.data.mapping.model.PreferredConstructorDiscoverer;
|
||||
import org.springframework.data.projection.ProjectionFactory;
|
||||
import org.springframework.data.projection.ProjectionInformation;
|
||||
import org.springframework.data.util.Lazy;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -227,8 +226,8 @@ public abstract class ReturnedType {
|
||||
|
||||
private static final Set<Class<?>> VOID_TYPES = new HashSet<>(Arrays.asList(Void.class, void.class));
|
||||
|
||||
private final Lazy<Boolean> isDto;
|
||||
private final Class<?> type;
|
||||
private final boolean isDto;
|
||||
private final List<String> inputProperties;
|
||||
|
||||
/**
|
||||
@@ -246,15 +245,14 @@ public abstract class ReturnedType {
|
||||
Assert.isTrue(!returnedType.isInterface(), "Returned type must not be an interface");
|
||||
|
||||
this.type = returnedType;
|
||||
this.isDto = Lazy.of(() ->
|
||||
!Object.class.equals(type) && //
|
||||
!type.isEnum() && //
|
||||
!isDomainSubtype() && //
|
||||
!isPrimitiveOrWrapper() && //
|
||||
!Number.class.isAssignableFrom(type) && //
|
||||
!VOID_TYPES.contains(type) && //
|
||||
!type.getPackage().getName().startsWith("java.")
|
||||
);
|
||||
this.isDto = !Object.class.equals(type) && //
|
||||
!type.isEnum() && //
|
||||
!isDomainSubtype() && //
|
||||
!isPrimitiveOrWrapper() && //
|
||||
!Number.class.isAssignableFrom(type) && //
|
||||
!VOID_TYPES.contains(type) && //
|
||||
!type.getPackage().getName().startsWith("java.");
|
||||
|
||||
this.inputProperties = detectConstructorParameterNames(returnedType);
|
||||
}
|
||||
|
||||
@@ -306,7 +304,7 @@ public abstract class ReturnedType {
|
||||
}
|
||||
|
||||
private boolean isDto() {
|
||||
return isDto.get();
|
||||
return isDto;
|
||||
}
|
||||
|
||||
private boolean isDomainSubtype() {
|
||||
|
||||
Reference in New Issue
Block a user