DATACMNS-1556 - General performance improvements in repository execution.
We now avoid the allocation of an Optional instance in the lookup of a dynamic projection in ParameterAccessor. Also, Lazy now exposes a ….getNullable() to be favored over ….getOptional() for hot code paths. Replaced Stream and Optional usage with for-loops and nullable return values. Reuse parameter names to avoid repeated annotation lookups. Reuse result from Parameters.getBindable(). Introduce ParametersParameterAccessor.getValues() to consistently reuse a single accessor instance allowing access to the unwrapped values. Introduce type cache to QueryExecutionConverters to quickly reject types that do not require wrapping. Avoid recalculation of QueryMethod.isCollectionQuery().
This commit is contained in:
committed by
Oliver Drotbohm
parent
e0f2d65d73
commit
293bbd9a63
@@ -146,7 +146,7 @@ public class ResultProcessorUnitTests {
|
||||
ResultProcessor factory = getProcessor("findOneDynamic", Class.class);
|
||||
assertThat(factory.withDynamicProjection(accessor)).isEqualTo(factory);
|
||||
|
||||
doReturn(Optional.of(SampleProjection.class)).when(accessor).getDynamicProjection();
|
||||
doReturn(SampleProjection.class).when(accessor).findDynamicProjection();
|
||||
|
||||
ResultProcessor processor = factory.withDynamicProjection(accessor);
|
||||
assertThat(processor.getReturnedType().getReturnedType()).isEqualTo(SampleProjection.class);
|
||||
|
||||
@@ -28,8 +28,9 @@ import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link Lazy}.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class LazyUnitTests {
|
||||
@@ -86,6 +87,11 @@ public class LazyUnitTests {
|
||||
assertThat(Lazy.of(() -> null).getOptional()).isEmpty();
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1556
|
||||
public void allowsNullableValue() {
|
||||
assertThat(Lazy.of(() -> null).getNullable()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ignoresElseIfValuePresent() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user