DATACMNS-1284 - Polishing.
Backport of06116b7. Related ticket: DATACMNS-1206. Original commit:06116b7.
This commit is contained in:
committed by
Oliver Gierke
parent
428b0decd5
commit
999d26436b
@@ -122,7 +122,14 @@ class DefaultProjectionInformation implements ProjectionInformation {
|
||||
final Map<String, Integer> orders = getMethodOrder(metadata);
|
||||
|
||||
for (PropertyDescriptor descriptor : filterDefaultMethods(BeanUtils.getPropertyDescriptors(type))) {
|
||||
if (metadata == null || orders.containsKey(descriptor.getReadMethod().getName())) {
|
||||
|
||||
Method readMethod = descriptor.getReadMethod();
|
||||
|
||||
if (readMethod == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (metadata == null || orders.containsKey(readMethod.getName())) {
|
||||
result.add(descriptor);
|
||||
}
|
||||
}
|
||||
@@ -237,6 +244,6 @@ class DefaultProjectionInformation implements ProjectionInformation {
|
||||
|
||||
Method method = descriptor.getReadMethod();
|
||||
|
||||
return method == null ? false : ReflectionUtils.isDefaultMethod(method);
|
||||
return method != null && ReflectionUtils.isDefaultMethod(method);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DefaultProjectionInformation}.
|
||||
@@ -40,6 +41,14 @@ public class DefaultProjectionInformationUnitTests {
|
||||
assertThat(toNames(information.getInputProperties()), contains("firstname", "lastname"));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1206, DATACMNS-1284
|
||||
public void omitsInputPropertiesAcceptingArguments() {
|
||||
|
||||
ProjectionInformation information = new DefaultProjectionInformation(ProjectionAcceptingArguments.class);
|
||||
|
||||
assertThat(toNames(information.getInputProperties()), contains("lastname"));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-89
|
||||
public void discoversAllInputProperties() {
|
||||
|
||||
@@ -83,6 +92,14 @@ public class DefaultProjectionInformationUnitTests {
|
||||
String getLastname();
|
||||
}
|
||||
|
||||
interface ProjectionAcceptingArguments {
|
||||
|
||||
@Value("foo")
|
||||
String getFirstname(int i);
|
||||
|
||||
String getLastname();
|
||||
}
|
||||
|
||||
interface ExtendedProjection extends CustomerProjection {
|
||||
|
||||
int getAge();
|
||||
|
||||
Reference in New Issue
Block a user