當前位置: 首頁>>代碼示例>>Java>>正文


Java CellProcessor類代碼示例

本文整理匯總了Java中org.supercsv.cellprocessor.ift.CellProcessor的典型用法代碼示例。如果您正苦於以下問題:Java CellProcessor類的具體用法?Java CellProcessor怎麽用?Java CellProcessor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CellProcessor類屬於org.supercsv.cellprocessor.ift包,在下文中一共展示了CellProcessor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getProcessors

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * Sets up the processors used for the examples. There are 10 CSV columns, so 10 processors are defined. Empty
 * columns are read as null (hence the NotNull() for mandatory columns).
 * 
 * @return the cell processors
 */
private static CellProcessor[] getProcessors() {
	
	final String emailRegex = "[a-z0-9\\._][email protected][a-z0-9\\.]+"; // just an example, not very robust!
	StrRegEx.registerMessage(emailRegex, "must be a valid email address");
	
	final CellProcessor[] processors = new CellProcessor[] { new UniqueHashCode(), // customerNo (must be unique)
		new NotNull(), // firstName
		new NotNull(), // lastName
		new ParseDate("dd/MM/yyyy"), // birthDate
		new NotNull(), // mailingAddress
		new Optional(new ParseBool()), // married
		new Optional(new ParseInt()), // numberOfKids
		new NotNull(), // favouriteQuote
		new StrRegEx(emailRegex), // email
		new LMinMax(0L, LMinMax.MAX_LONG) // loyaltyPoints
	};
	
	return processors;
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:26,代碼來源:Reading.java

示例2: getAggregatedCstStatistic

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
static Statistics getAggregatedCstStatistic(final Collection<File> csv_files, CellProcessor[] processors, Integer column_index, boolean header) throws IOException {

        final Statistics statistics = new Statistics();
        for (File csv : csv_files) {
            final CsvListReader reader = getCsvListReader(csv, header);
            try {
                List<Object> row;
                while ((row = reader.read(processors)) != null) {
                    statistics.addSample((Number) row.get(column_index));
                }
            }
            finally {
                IOUtils.closeQuietly(reader);
            }
        }

        return statistics;
    }
 
開發者ID:stacs-srg,項目名稱:shabdiz,代碼行數:19,代碼來源:AnalyticsUtil.java

示例3: getProcessors

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
private static CellProcessor[] getProcessors() {
    final CellProcessor[] processors = new CellProcessor[]{
            new ParseInt(), // id (must be unique)
            new NotNull(), // address
            new NotNull(), // horario
            new ParseDouble(), //lat
            new ParseDouble(), //long
            new NotNull(), // name
            new Optional(), // phone
            new Optional(), // locality
            new Optional(), // province
            new Optional(), // postal_code

    };
    return processors;
}
 
開發者ID:cahergil,項目名稱:Farmacias,代碼行數:17,代碼來源:CsvReader.java

示例4: getProcessors

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
public static CellProcessor[] getProcessors(List<String> fields) {

		int fieldsSize = fields.size();
		final CellProcessor[] processors = new CellProcessor[fieldsSize];
		int i = 0;
		for(String field : fields){
			if(Arrays.asList(processorsDateType).contains(field)){
				processors[i] =  new Optional(new FmtDate("dd-MM-yyyy HH:mm"));
			}else{
				processors[i] = new ConvertNullTo("");
			}
			i++;
		}

		return processors;
	}
 
開發者ID:EsupPortail,項目名稱:esup-sgc,代碼行數:17,代碼來源:ImportExportService.java

示例5: getFieldsByExplicitIndex

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
private static Map<Integer, BeanCell> getFieldsByExplicitIndex(List<Field> fields, BeanDescriptor beanDescriptor, String context) {
    Map<Integer, BeanCell> result = new HashMap<>();
    for (Field field : fields) {
        CsvField fieldAnnotation = field.getAnnotation(CsvField.class);
        if (fieldAnnotation != null) {
            if (result.containsKey(fieldAnnotation.index())) {
                throw new SuperCsvException(Form.at("Explicit order-index {} was declared twice (Field: {}", fieldAnnotation.index(),
                        field.getName()));
            }

            CellProcessor cellProcessor = BeanCellProcessorExtractor.createCellProcessorFor(beanDescriptor, field, context);
            FieldAccessStrategy fieldAccessStrategy = createFieldAccessStrategy(beanDescriptor.getAccessType());
            result.put(fieldAnnotation.index(), new ExistingBeanCell(field, cellProcessor, fieldAccessStrategy));
        }
    }

    return result;
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:BeanCells.java

示例6: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<StrMinMax> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.StrMinMax(metadata.getAnnotation().min(), metadata.getAnnotation().max(), next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:StrMinMaxCellProcessorProvider.java

示例7: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<NotNull> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.NotNull(next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:NotNullCellProcessorProvider.java

示例8: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<Unique> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.Unique(next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:UniqueCellProcessorProvider.java

示例9: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<StrRegEx> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.StrRegEx(metadata.getAnnotation().regex(),
                    (StringCellProcessor) next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:20,代碼來源:StrRegExCellProcessorProvider.java

示例10: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<StrLen> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.Strlen(metadata.getAnnotation().requiredLengths(), next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:StrLenCellProcessorProvider.java

示例11: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<LMinMax> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            LMinMax annotation = metadata.getAnnotation();
            return new org.supercsv.cellprocessor.constraint.LMinMax(annotation.min(), annotation.max(),
                    (LongCellProcessor) next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:21,代碼來源:LMinMaxCellProcessorProvider.java

示例12: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<Equals> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.Equals(next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:EqualsCellProcessorProvider.java

示例13: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<UniqueHashCode> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.UniqueHashCode(next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:UniqueHashCodeCellProcessorProvider.java

示例14: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<ForbidSubStr> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.ForbidSubStr(metadata.getAnnotation().forbiddenSubStrings(), next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:ForbidSubStrCellProcessorProvider.java

示例15: create

import org.supercsv.cellprocessor.ift.CellProcessor; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CellProcessorFactory create(ProcessingMetadata<RequireHashCode> metadata) {
    return new CellProcessorFactory() {

        @Override
        public int getOrder() {
            return metadata.getAnnotation().order();
        }

        @Override
        public CellProcessor create(CellProcessor next) {
            return new org.supercsv.cellprocessor.constraint.RequireHashCode(metadata.getAnnotation().requiredHashCodes(), next);
        }
    };
}
 
開發者ID:dmn1k,項目名稱:super-csv-declarative,代碼行數:19,代碼來源:RequireHashCodeCellProcessorProvider.java


注:本文中的org.supercsv.cellprocessor.ift.CellProcessor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。