本文整理汇总了Java中org.supercsv.cellprocessor.ConvertNullTo类的典型用法代码示例。如果您正苦于以下问题:Java ConvertNullTo类的具体用法?Java ConvertNullTo怎么用?Java ConvertNullTo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConvertNullTo类属于org.supercsv.cellprocessor包,在下文中一共展示了ConvertNullTo类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getProcessors
import org.supercsv.cellprocessor.ConvertNullTo; //导入依赖的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
示例2: writeCsv
import org.supercsv.cellprocessor.ConvertNullTo; //导入依赖的package包/类
public static <V> void writeCsv(final DataFrame<V> df, final OutputStream output)
throws IOException {
try (CsvListWriter writer = new CsvListWriter(new OutputStreamWriter(output), CsvPreference.STANDARD_PREFERENCE)) {
final String[] header = new String[df.size()];
final Iterator<Object> it = df.columns().iterator();
for (int c = 0; c < df.size(); c++) {
header[c] = String.valueOf(it.hasNext() ? it.next() : c);
}
writer.writeHeader(header);
final CellProcessor[] procs = new CellProcessor[df.size()];
final List<Class<?>> types = df.types();
for (int c = 0; c < df.size(); c++) {
final Class<?> cls = types.get(c);
if (Date.class.isAssignableFrom(cls)) {
procs[c] = new ConvertNullTo("", new FmtDate("yyyy-MM-dd'T'HH:mm:ssXXX"));
} else {
procs[c] = new ConvertNullTo("");
}
}
for (final List<V> row : df) {
writer.write(row, procs);
}
}
}
开发者ID:cardillo,项目名称:joinery,代码行数:25,代码来源:Serialization.java
示例3: readCompleteWorkAuthors
import org.supercsv.cellprocessor.ConvertNullTo; //导入依赖的package包/类
private List<String> readCompleteWorkAuthors(String inputFilename) throws FileNotFoundException, IOException {
CellProcessor[] processors = new CellProcessor[62];
for (int x = 0; x < processors.length; x++) {
processors[x] = new ConvertNullTo("");
}
List<String> result = new ArrayList<>(5000);
try (ICsvListReader listReader = new CsvListReader(new FileReader(
inputFilename), CsvPreference.STANDARD_PREFERENCE)) {
listReader.getHeader(true); //skip titles
List<Object> ergList;
while ((ergList = listReader.read(processors)) != null) {
if ("1".equals(ergList.get(5)) && !ergList.get(17).toString().isEmpty()) {
result.add(ergList.get(17).toString());
}
}
}
return result;
}
开发者ID:mhinters,项目名称:BannedBookUtils,代码行数:21,代码来源:CompleteWorksFinder.java
示例4: getProcessors
import org.supercsv.cellprocessor.ConvertNullTo; //导入依赖的package包/类
private CellProcessor[] getProcessors() {
return new CellProcessor[] { new ParseInt(), // device id
new JodaTimeCellProcessor().withSupportForPattern(Constants.DATE_TIME_PATTERN_POSTGRES), // timestamp
new ConvertNullTo(Double.NaN, new ParseDouble()), // speed
new ConvertNullTo(Double.NaN, new ParseDouble()), // longitude
new ConvertNullTo(Double.NaN, new ParseDouble()), // latitude
new ConvertNullTo(Double.NaN, new ParseDouble()), // altitude
new ConvertNullTo(Double.NaN, new ParseDouble()), // tspeed
new ConvertNullTo(-1, new ParseInt()), // index
new ConvertNullTo(Double.NaN, new ParseDouble()), // x
new ConvertNullTo(Double.NaN, new ParseDouble()), // y
new ConvertNullTo(Double.NaN, new ParseDouble()) // z
};
}
开发者ID:NLeSC,项目名称:eEcology-Classification,代码行数:15,代码来源:UnannotatedMeasurementsCsvLoader.java
示例5: createProcessors
import org.supercsv.cellprocessor.ConvertNullTo; //导入依赖的package包/类
private CellProcessor[] createProcessors(String[] header) {
CellProcessor[] procs = new CellProcessor[header.length];
procs[0] = new Unique();
for (int i = 1; i < header.length; i++) {
procs[i] = new ConvertNullTo("");
}
return procs;
}
开发者ID:inepex,项目名称:ineform,代码行数:10,代码来源:RowUploadActionHandler.java
注:本文中的org.supercsv.cellprocessor.ConvertNullTo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论