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


Java ParameterType类代码示例

本文整理汇总了Java中org.springframework.batch.core.JobParameter.ParameterType的典型用法代码示例。如果您正苦于以下问题:Java ParameterType类的具体用法?Java ParameterType怎么用?Java ParameterType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParameterType类属于org.springframework.batch.core.JobParameter包,在下文中一共展示了ParameterType类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insertParameter

import org.springframework.batch.core.JobParameter.ParameterType; //导入依赖的package包/类
/**
 * Convenience method that inserts an individual records into the
 * JobParameters table.
 * @param jobId Set the job id
 * @param type Set the parameter type
 * @param key Set the parameter name
 * @param value Set the parameter value
 */
private void insertParameter(final Long jobId, final ParameterType type,
		final String key, final Object value) {

	Object[] args = new Object[0];
	int[] argTypes = new int[] {Types.BIGINT, Types.VARCHAR,
			Types.VARCHAR, Types.VARCHAR, Types.TIMESTAMP, Types.BIGINT,
			Types.DOUBLE };

	if (type == ParameterType.STRING) {
		args = new Object[] {jobId, key, type, value, new Timestamp(0L),
				0L, 0D };
	} else if (type == ParameterType.LONG) {
		args = new Object[] {jobId, key, type, "", new Timestamp(0L),
				value, new Double(0) };
	} else if (type == ParameterType.DOUBLE) {
		args = new Object[] {jobId, key, type, "", new Timestamp(0L), 0L,
				value };
	} else if (type == ParameterType.DATE) {
		args = new Object[] {jobId, key, type, "", value, 0L, 0D };
	}

	getJdbcTemplate().update("INSERT into BATCH_JOB_PARAMS(JOB_INSTANCE_ID, KEY_NAME, TYPE_CD, "
			+ "STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL) values (?, ?, ?, ?, ?, ?, ?)", args, argTypes);
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:33,代码来源:JobInstanceDaoImpl.java

示例2: convert

import org.springframework.batch.core.JobParameter.ParameterType; //导入依赖的package包/类
@Override
public JobParameters convert(final JsonNode root) {
	final JobParametersBuilder builder = new JobParametersBuilder();

	final Iterator<String> it = root.fieldNames();
	while (it.hasNext()) {
		final String paramName = it.next();
		final JsonNode param = root.get(paramName);
		final ParameterType type = ParameterType.valueOf(param.get("type").textValue());

		final JsonNode value = param.get("value");
		final boolean identifying = param.get("identifying").booleanValue();

		switch (type) {
		case STRING:
			builder.addString(paramName, value.textValue(), identifying);
			break;
		case DATE:
			builder.addDate(paramName, new Date(value.longValue()), identifying);
			break;
		case DOUBLE:
			builder.addDouble(paramName, value.doubleValue(), identifying);
			break;
		case LONG:
			builder.addLong(paramName, value.longValue(), identifying);
			break;
		default:
			throw new IllegalArgumentException("Unknown job parameter type: " + type);
		}
	}

	return builder.toJobParameters();
}
 
开发者ID:phjardas,项目名称:spring-batch-tools,代码行数:34,代码来源:BatchJacksonModule.java

示例3: DefaultJobParameterInfo

import org.springframework.batch.core.JobParameter.ParameterType; //导入依赖的package包/类
public DefaultJobParameterInfo(final String name, final String description, final ParameterType type, final boolean identifying,
		final Object defaultValue) {
	this.name = name;
	this.description = description;
	this.type = type;
	this.identifying = identifying;
	this.defaultValue = defaultValue;
}
 
开发者ID:phjardas,项目名称:spring-batch-tools,代码行数:9,代码来源:DefaultJobParameterInfo.java

示例4: registerJobParameterInfos

import org.springframework.batch.core.JobParameter.ParameterType; //导入依赖的package包/类
@Override
public void registerJobParameterInfos(final JobParameterInfoRegistry registry) {
	final JobParametersInfo parametersInfo = new JobParametersInfoBuilder() //
			.add("run.id", ParameterType.LONG, true, null, null) //
			.build();

	registry.addJobParametersInfo(TestJobConfig.JOB_NAME, parametersInfo);
}
 
开发者ID:phjardas,项目名称:spring-batch-tools,代码行数:9,代码来源:TestJobParameterInfoRegistrar.java

示例5: add

import org.springframework.batch.core.JobParameter.ParameterType; //导入依赖的package包/类
public JobParametersInfoBuilder add(final String name, final ParameterType type, final boolean identifiable, final Object defaultValue,
		final String description) {
	return add(new DefaultJobParameterInfo(name, description, type, identifiable, defaultValue));
}
 
开发者ID:phjardas,项目名称:spring-batch-tools,代码行数:5,代码来源:JobParametersInfoBuilder.java

示例6: getType

import org.springframework.batch.core.JobParameter.ParameterType; //导入依赖的package包/类
@Override
public ParameterType getType() {
	return type;
}
 
开发者ID:phjardas,项目名称:spring-batch-tools,代码行数:5,代码来源:DefaultJobParameterInfo.java

示例7: getType

import org.springframework.batch.core.JobParameter.ParameterType; //导入依赖的package包/类
ParameterType getType(); 
开发者ID:phjardas,项目名称:spring-batch-tools,代码行数:2,代码来源:JobParameterInfo.java


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