Disable fuzzy matching when distanceLimit = 0

Before this commit, fuzzy matching is performed even though exact
matching is requested (distanceLimit = 0).

This commit bypasses fuzzy matching when distanceLimit = 0 which
improves performance.

Resolves BATCH-1801
This commit is contained in:
Mahmoud Ben Hassine
2019-05-30 14:22:38 +02:00
parent 39f4d71949
commit cae3f33122

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,6 +91,7 @@ import org.springframework.validation.DataBinder;
* match is found. If more than one match is found there will be an error.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar implements FieldSetMapper<T>,
@@ -259,6 +260,10 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
*/
private Properties getBeanProperties(Object bean, Properties properties) {
if (this.distanceLimit == 0) {
return properties;
}
Class<?> cls = bean.getClass();
// Map from field names to property names