本文整理汇总了Java中org.springframework.batch.item.ExecutionContext.putInt方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionContext.putInt方法的具体用法?Java ExecutionContext.putInt怎么用?Java ExecutionContext.putInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.batch.item.ExecutionContext
的用法示例。
在下文中一共展示了ExecutionContext.putInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
@Override
public void update(ExecutionContext executionContext) throws
ItemStreamException {
/* Clear context */
for (Entry<String, Object> entry : executionContext.entrySet()) {
String key = entry.getKey();
executionContext.remove(key);
}
executionContext.putInt(IDS_NUMBER, number);
executionContext.putInt(CURRENT_ID_COUNT, count);
for (int i = 0; i < number; i++) {
executionContext.putString(LIST_ID + i, ids[i]);
}
}
示例2: marshallExecutionContextTest
import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
@Test
public void marshallExecutionContextTest() throws Exception {
ExecutionContext ec = new ExecutionContext();
ec.putString("testName", "testValue");
ec.putLong("testLong", 123L);
ec.putDouble("testDouble", 123D);
ec.putInt("testInteger", 123);
ExecutionContextAdapter adapter = new ExecutionContextAdapter();
jaxb2Marshaller.marshal(adapter.marshal(ec), result);
Fragment frag = new Fragment(new DOMBuilder().build(doc));
frag.setNamespaces(getNamespaceProvider().getNamespaces());
frag.prettyPrint();
frag.assertElementExists("/msb:executionContext/msb:map/entry/key[text() = 'testName']");
frag.assertElementExists("/msb:executionContext/msb:map/entry/value[@xsi:type = 'xs:int'][text() = '123']");
frag.assertElementExists("/msb:executionContext/msb:map/entry/value[@xsi:type = 'xs:long'][text() = '123']");
frag.assertElementExists("/msb:executionContext/msb:map/entry/value[@xsi:type = 'xs:string'][text() = 'testValue']");
frag.assertElementExists("/msb:executionContext/msb:map/entry/value[@xsi:type = 'xs:double'][text() = '123.0']");
frag.assertElementExists("/msb:executionContext/msb:hashCode");
}
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:20,代码来源:MarshallSpringBatchPojoToXmlTest.java
示例3: partition
import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
/**
* Partition a database table assuming that the data in the column specified
* are uniformly distributed. The execution context values will have keys
* <code>minValue</code> and <code>maxValue</code> specifying the range of
* values to consider in each partition.
*
* @see Partitioner#partition(int)
*/
@Override
public Map<String, ExecutionContext> partition(int gridSize) {
int min = jdbcTemplate.queryForObject("SELECT MIN(" + column + ") from " + table, Integer.class);
int max = jdbcTemplate.queryForObject("SELECT MAX(" + column + ") from " + table, Integer.class);
int targetSize = (max - min) / gridSize + 1;
Map<String, ExecutionContext> result = new HashMap<String, ExecutionContext>();
int number = 0;
int start = min;
int end = start + targetSize - 1;
while (start <= max) {
ExecutionContext value = new ExecutionContext();
result.put("partition" + number, value);
if (end >= max) {
end = max;
}
value.putInt("minValue", start);
value.putInt("maxValue", end);
start += targetSize;
end += targetSize;
number++;
}
return result;
}
示例4: getStepExecution
import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
private StepExecution getStepExecution() {
JobExecution jobExecution = new JobExecution(1L, null, "hi");
final StepExecution stepExecution = new StepExecution("step1", jobExecution);
jobExecution.createStepExecution("step1");
final ExecutionContext executionContext = stepExecution.getExecutionContext();
executionContext.putInt("counter", 1234);
executionContext.putDouble("myDouble", 1.123456d);
executionContext.putLong("Josh", 4444444444L);
executionContext.putString("awesomeString", "Yep");
executionContext.put("hello", "world");
executionContext.put("counter2", 9999);
return stepExecution;
}
示例5: update
import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
@Override
public void update(ExecutionContext executionContext) throws ItemStreamException {
executionContext.putInt(key, currentCount);
}
示例6: update
import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
@Override
public void update(ExecutionContext executionContext) throws ItemStreamException {
executionContext.putInt("count", count);
}