本文整理汇总了Java中org.pentaho.di.trans.steps.textfileinput.TextFileInputField.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java TextFileInputField.setPosition方法的具体用法?Java TextFileInputField.setPosition怎么用?Java TextFileInputField.setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.trans.steps.textfileinput.TextFileInputField
的用法示例。
在下文中一共展示了TextFileInputField.setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: injectStepMetadataEntries
import org.pentaho.di.trans.steps.textfileinput.TextFileInputField; //导入方法依赖的package包/类
@Override
public void injectStepMetadataEntries(List<StepInjectionMetaEntry> all) throws KettleException {
List<TextFileInputField> fields = new ArrayList<TextFileInputField>();
// Parse the fields, inject into the meta class..
//
for (StepInjectionMetaEntry lookFields : all) {
Entry fieldsEntry = Entry.findEntry(lookFields.getKey());
if (fieldsEntry==null) continue;
String lookValue = (String)lookFields.getValue();
switch(fieldsEntry) {
case FIELDS:
{
for (StepInjectionMetaEntry lookField : lookFields.getDetails()) {
Entry fieldEntry = Entry.findEntry(lookField.getKey());
if (fieldEntry == Entry.FIELD) {
TextFileInputField field = new TextFileInputField();
List<StepInjectionMetaEntry> entries = lookField.getDetails();
for (StepInjectionMetaEntry entry : entries) {
Entry metaEntry = Entry.findEntry(entry.getKey());
if (metaEntry!=null) {
String value = (String)entry.getValue();
switch(metaEntry) {
case FIELD_NAME: field.setName(value); break;
case FIELD_POSITION: field.setPosition(Const.toInt(value, -1)); break;
case FIELD_LENGTH: field.setLength(Const.toInt(value, -1)); break;
case FIELD_TYPE: field.setType(ValueMeta.getType(value)); break;
case FIELD_IGNORE: field.setIgnored("Y".equalsIgnoreCase(value)); break;
case FIELD_FORMAT: field.setFormat(value); break;
case FIELD_TRIM_TYPE: field.setTrimType(ValueMeta.getTrimTypeByCode(value)); break;
case FIELD_PRECISION: field.setPrecision(Const.toInt(value, -1)); break;
case FIELD_DECIMAL: field.setDecimalSymbol(value); break;
case FIELD_GROUP: field.setGroupSymbol(value); break;
case FIELD_CURRENCY: field.setCurrencySymbol(value); break;
case FIELD_REPEAT: field.setRepeated("Y".equalsIgnoreCase(value)); break;
case FIELD_NULL_STRING: field.setNullString(value); break;
case FIELD_IF_NULL: field.setIfNullValue(value); break;
}
}
}
fields.add(field);
}
}
}
break;
case FILENAME: meta.setFilename(lookValue); break;
case FILENAME_FIELD : meta.setFilenameField(lookValue); break;
case ROW_NUMBER_FIELD : meta.setRowNumField(lookValue); break;
case INCLUDING_FILENAMES: meta.setIncludingFilename("Y".equalsIgnoreCase(lookValue)); break;
case DELIMITER: meta.setDelimiter(lookValue); break;
case ENCLOSURE: meta.setEnclosure(lookValue); break;
case HEADER_PRESENT: meta.setHeaderPresent("Y".equalsIgnoreCase(lookValue)); break;
case BUFFER_SIZE: meta.setBufferSize(lookValue); break;
case LAZY_CONVERSION: meta.setLazyConversionActive("Y".equalsIgnoreCase(lookValue)); break;
case ADD_FILES_TO_RESULT: meta.setAddResultFile("Y".equalsIgnoreCase(lookValue)); break;
case RUN_IN_PARALLEL: meta.setRunningInParallel("Y".equalsIgnoreCase(lookValue)); break;
case ENCODING: meta.setEncoding(lookValue); break;
}
}
// If we got fields, use them, otherwise leave the defaults alone.
//
if (fields.size()>0) {
meta.setInputFields(fields.toArray(new TextFileInputField[fields.size()]));
}
}