BATCH-2205:

MethodInvokingTaskletAdaper does not support primitive arguments.
 - Improvement of
AbstractMethodInvokingDelegator.targetClassDeclaresTargetMethod()
This commit is contained in:
Seo Kyung-Seok
2014-08-28 09:12:35 +09:00
committed by Michael Minella
parent 55ca2bc895
commit 834d8ee627
3 changed files with 13 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ import java.util.List;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.MethodInvoker;
/**
@@ -167,7 +168,7 @@ public abstract class AbstractMethodInvokingDelegator<T> implements Initializing
if (arguments[j] == null) {
continue;
}
if (!(params[j].isAssignableFrom(arguments[j].getClass()))) {
if (!(ClassUtils.isAssignableValue(params[j], arguments[j]))) {
argumentsMatchParameters = false;
}
}

View File

@@ -27,6 +27,13 @@
class="org.springframework.batch.core.step.tasklet.MethodInvokingTaskletAdapter">
<property name="targetObject" ref="value" />
<property name="targetMethod" value="execute" />
<property name="arguments">
<list>
<value>foo2</value>
<value type="int">3</value>
<value type="double">3.14</value>
</list>
</property>
</bean>
<bean id="value"

View File

@@ -50,8 +50,11 @@ public class TaskletJobFunctionalTests {
this.value = value;
}
public void execute() {
public void execute(String strValue, Integer integerValue, double doubleValue) {
assertEquals("foo", value);
assertEquals("foo2", strValue);
assertEquals(3, integerValue.intValue());
assertEquals(3.14, doubleValue, 0.01);
}
}