@@ -85,7 +85,7 @@ class DefaultProjectionInformation implements ProjectionInformation {
|
||||
|
||||
@Override
|
||||
public boolean isClosed() {
|
||||
return this.properties.equals(getInputProperties());
|
||||
return hasInputProperties() && this.properties.equals(getInputProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,8 @@ package org.springframework.data.projection;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Information about a projection type.
|
||||
*
|
||||
@@ -40,6 +42,17 @@ public interface ProjectionInformation {
|
||||
*/
|
||||
List<PropertyDescriptor> getInputProperties();
|
||||
|
||||
/**
|
||||
* Returns whether the projection has input properties. Projections without input types are typically open projections
|
||||
* that do not follow Java's property accessor naming.
|
||||
*
|
||||
* @return
|
||||
* @since 3.3.5
|
||||
*/
|
||||
default boolean hasInputProperties() {
|
||||
return !CollectionUtils.isEmpty(getInputProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether supplying values for the properties returned via {@link #getInputProperties()} is sufficient to
|
||||
* create a working proxy instance. This will usually be used to determine whether the projection uses any dynamically
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.lang.NonNull;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -130,9 +131,21 @@ public abstract class ReturnedType {
|
||||
* Returns the properties required to be used to populate the result.
|
||||
*
|
||||
* @return
|
||||
* @see ProjectionInformation#getInputProperties()
|
||||
*/
|
||||
public abstract List<String> getInputProperties();
|
||||
|
||||
/**
|
||||
* Returns whether the returned type has input properties.
|
||||
*
|
||||
* @return
|
||||
* @since 3.3.5
|
||||
* @see ProjectionInformation#hasInputProperties()
|
||||
*/
|
||||
public boolean hasInputProperties() {
|
||||
return !CollectionUtils.isEmpty(getInputProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link ReturnedType} that's backed by an interface.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user