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


Java TextFileInputField.setPosition方法代码示例

本文整理汇总了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()]));
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:74,代码来源:ParGzipCsvInputMetaInjection.java


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