本文整理汇总了Java中org.springframework.batch.item.file.transform.FieldSet.getNames方法的典型用法代码示例。如果您正苦于以下问题:Java FieldSet.getNames方法的具体用法?Java FieldSet.getNames怎么用?Java FieldSet.getNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.batch.item.file.transform.FieldSet
的用法示例。
在下文中一共展示了FieldSet.getNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapFieldSet
import org.springframework.batch.item.file.transform.FieldSet; //导入方法依赖的package包/类
@Override
public T mapFieldSet(FieldSet fieldSet) throws BindException {
T entity = null;
Integer indexColumn = fileOption.getKeyColumn();
String indexColumnName = fieldSet.getNames()[indexColumn];
Function<String, T> finder = getEntityFinder(indexColumnName);
if (finder == null) {
throw new BindException(entityType, "finder '" + indexColumnName + "' not found.");
}
String indexColumnValue = fieldSet.readString(indexColumn);
entity = finder.apply(indexColumnValue);
if (entity == null) {
entity = newEntitySupplier.get();
}
bindData(entity, fieldSet.getProperties());
return entity;
}
示例2: mapFieldSet
import org.springframework.batch.item.file.transform.FieldSet; //导入方法依赖的package包/类
protected Map<String, Object> mapFieldSet(FieldSet sFieldSet, int sRecIdx) {
Map<String, Object> aResult = new HashMap<String, Object>();
if (sFieldSet != null) {
boolean aHasNames = sFieldSet.hasNames();
int aFieldCount = sFieldSet.getFieldCount();
String[] aNames = aHasNames ? sFieldSet.getNames() : null;
String[] aValues = sFieldSet.getValues();
for(int i = 0; i < aFieldCount; i++) {
aResult.put(String.format(fieldsetNameFormat, sRecIdx, (aHasNames && (aNames[i] != null) && !aNames[i].isEmpty()) ? aNames[i] : String.format(unnamedColumnFormat, i)), aValues[i]);
}
}
return aResult;
}
示例3: mapFieldSet
import org.springframework.batch.item.file.transform.FieldSet; //导入方法依赖的package包/类
protected MapSqlParameterSource mapFieldSet(MapSqlParameterSource sMapSqlParameterSource, FieldSet sFieldSet, int sRecIdx) {
if (sFieldSet != null) {
boolean aHasNames = sFieldSet.hasNames();
int aFieldCount = sFieldSet.getFieldCount();
String[] aNames = aHasNames ? sFieldSet.getNames() : null;
String[] aValues = sFieldSet.getValues();
for(int i = 0; i < aFieldCount; i++) {
sMapSqlParameterSource.addValue(String.format(fieldsetNameFormat, sRecIdx, (aHasNames && (aNames[i] != null) && !aNames[i].isEmpty()) ? aNames[i] : String.format(unnamedColumnFormat, i)), aValues[i]);
}
}
return sMapSqlParameterSource;
}