当前位置: 首页>>代码示例>>Java>>正文


Java ExecutionContext.putInt方法代码示例

本文整理汇总了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]);
    }
}
 
开发者ID:hosuaby,项目名称:signature-processing,代码行数:18,代码来源:ListIdsItemReader.java

示例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;
}
 
开发者ID:mminella,项目名称:java-remote-partitioning,代码行数:36,代码来源:ColumnRangePartitioner.java

示例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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:16,代码来源:StepExecutionJacksonMixInTests.java

示例5: update

import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
@Override
public void update(ExecutionContext executionContext) throws ItemStreamException {
	executionContext.putInt(key, currentCount);
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:5,代码来源:DirectoryReader.java

示例6: update

import org.springframework.batch.item.ExecutionContext; //导入方法依赖的package包/类
@Override
public void update(ExecutionContext executionContext) throws ItemStreamException {
    executionContext.putInt("count", count);
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:5,代码来源:HttpJsonItemReader.java


注:本文中的org.springframework.batch.item.ExecutionContext.putInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。