本文整理汇总了Java中org.springframework.batch.item.file.transform.FieldSet.getFieldCount方法的典型用法代码示例。如果您正苦于以下问题:Java FieldSet.getFieldCount方法的具体用法?Java FieldSet.getFieldCount怎么用?Java FieldSet.getFieldCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.batch.item.file.transform.FieldSet
的用法示例。
在下文中一共展示了FieldSet.getFieldCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapFieldSet
import org.springframework.batch.item.file.transform.FieldSet; //导入方法依赖的package包/类
@Override
public LHHuntingClubCSVRow mapFieldSet(FieldSet fieldSet) {
if (fieldSet.getFieldCount() <= 1) {
LOG.debug("Ignoring invalid row: {}", formatRow(fieldSet));
return null;
}
if (fieldSet.getFieldCount() != EXPECTED_FIELD_COUNT) {
LOG.error("Invalid field set with field count {}, expexcted {}",
fieldSet.getFieldCount(), EXPECTED_FIELD_COUNT);
LOG.debug("Invalid row was: {}", formatRow(fieldSet));
throw new IllegalStateException(
MessageFormat.format("Invalid field set with field count {0}, expected {1}",
fieldSet.getFieldCount(), EXPECTED_FIELD_COUNT));
}
return csvToRow(fieldSet);
}
示例2: formatRow
import org.springframework.batch.item.file.transform.FieldSet; //导入方法依赖的package包/类
private static String formatRow(final FieldSet fieldSet) {
List<String> strings = new ArrayList<>();
for (int i = 0; i < fieldSet.getFieldCount(); ++i) {
strings.add(fieldSet.readString(i));
}
return StringUtils.join(strings, "\t");
}
示例3: 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;
}
示例4: 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;
}
示例5: mapFieldSet
import org.springframework.batch.item.file.transform.FieldSet; //导入方法依赖的package包/类
@Override
public InnofactorImportFileLine mapFieldSet(FieldSet fieldSet) {
if (fieldSet.getFieldCount() <= 1) {
LOG.debug("Ignoring invalid row: {}", formatRow(fieldSet));
return null;
}
if (fieldSet.getFieldCount() != EXPECTED_FIELD_COUNT &&
fieldSet.getFieldCount() != EXPECTED_FIELD_COUNT_WITHOUT_INVOICE_REF) {
LOG.error("Invalid field set with field count {}, expexcted {}",
fieldSet.getFieldCount(), EXPECTED_FIELD_COUNT);
LOG.debug("Invalid row was: {}", formatRow(fieldSet));
throw new IllegalStateException(
MessageFormat.format("Invalid field set with field count {0}, expected {1}",
fieldSet.getFieldCount(), EXPECTED_FIELD_COUNT));
}
final InnofactorImportFileLine person = new InnofactorImportFileLine();
int fieldCounter = 0;
person.setHunterNumber(fieldSet.readString(fieldCounter++));
person.setSsn(fieldSet.readString(fieldCounter++));
person.setModificationDate(readLocalDate(fieldSet, fieldCounter++));
person.setDeletionDate(readLocalDate(fieldSet, fieldCounter++));
person.setDeletionStatus(parseDeletedCode(fieldSet, fieldCounter++));
person.setLastName(fieldSet.readString(fieldCounter++));
person.setFirstName(fieldSet.readString(fieldCounter++));
person.setLanguageCode(fieldSet.readString(fieldCounter++));
person.setMagazineLanguageCode(fieldSet.readString(fieldCounter++));
person.setEmail(fieldSet.readString(fieldCounter++));
person.setHomeMunicipalityCode(fieldSet.readString(fieldCounter++));
person.setMembershipRhyOfficialCode(fieldSet.readString(fieldCounter++));
person.setHuntingPaymentOneDay(readLocalDate(fieldSet, fieldCounter++));
person.setHuntingPaymentTwoDay(readLocalDate(fieldSet, fieldCounter++));
person.setHuntingPaymentOneYear(readInteger(fieldSet, fieldCounter++));
person.setHuntingPaymentTwoYear(readInteger(fieldSet, fieldCounter++));
person.setHuntingCardStart(readLocalDate(fieldSet, fieldCounter++));
person.setHuntingCardEnd(readLocalDate(fieldSet, fieldCounter++));
person.setHunterExamDate(readLocalDate(fieldSet, fieldCounter++));
person.setHunterExamExpirationDate(readLocalDate(fieldSet, fieldCounter++));
person.setHuntingBanStart(readLocalDate(fieldSet, fieldCounter++));
person.setHuntingBanEnd(readLocalDate(fieldSet, fieldCounter++));
person.setStreetAddress(fieldSet.readString(fieldCounter++));
person.setPostalCode(fieldSet.readString(fieldCounter++));
person.setPostOffice(fieldSet.readString(fieldCounter++));
person.setCountryCode(fieldSet.readString(fieldCounter++));
person.setCountryName(fieldSet.readString(fieldCounter++));
person.setForbidMagazine(fieldSet.readBoolean(fieldCounter++, BOOLEAN_TRUE));
person.setForbidAddressDelegation(fieldSet.readBoolean(fieldCounter++, BOOLEAN_TRUE));
person.setForbidPosting(fieldSet.readBoolean(fieldCounter++, BOOLEAN_TRUE));
if (fieldSet.getFieldCount() == EXPECTED_FIELD_COUNT) {
person.setInvoiceReferenceCurrent(fieldSet.readString(fieldCounter++));
person.setInvoiceReferencePrevious(fieldSet.readString(fieldCounter++));
person.setInvoiceReferenceCurrentYear(readInteger(fieldSet, fieldCounter++));
person.setInvoiceReferencePreviousYear(readInteger(fieldSet, fieldCounter++));
}
return person;
}