com.github.skjolber.stcsv.builder.CsvMappingBuilder2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of databinder Show documentation
Show all versions of databinder Show documentation
High-performance CSV databinding library
package com.github.skjolber.stcsv.builder;
import java.util.List;
import com.github.skjolber.stcsv.AbstractColumn;
import com.github.skjolber.stcsv.CsvMapper2;
import com.github.skjolber.stcsv.column.tri.BooleanCsvFieldMapperTriBuilder;
import com.github.skjolber.stcsv.column.tri.CsvFieldMapperTriBuilder;
import com.github.skjolber.stcsv.column.tri.DoubleCsvFieldMapperTriBuilder;
import com.github.skjolber.stcsv.column.tri.IntCsvFieldMapperTriBuilder;
import com.github.skjolber.stcsv.column.tri.LongCsvFieldMapperTriBuilder;
import com.github.skjolber.stcsv.column.tri.StringCsvFieldMapperTriBuilder;
public class CsvMappingBuilder2 extends AbstractCsvMappingBuilder> {
private Class intermediate;
public CsvMappingBuilder2(Class cls, Class intermediate) {
super(cls);
this.intermediate = intermediate;
}
public CsvMapper2 build() throws CsvBuilderException {
List columns = toColumns();
ClassLoader classLoader = this.classLoader;
if(classLoader == null) {
classLoader = getDefaultClassLoader();
}
if(bufferLength <= 0) {
throw new IllegalArgumentException("Expected positive buffer length");
}
return new CsvMapper2(target, intermediate, divider, columns, skipEmptyLines, skipComments, skippableFieldsWithoutLinebreaks, classLoader, bufferLength);
}
public StringCsvFieldMapperTriBuilder> stringField(String name) {
return new StringCsvFieldMapperTriBuilder>(this, name, intermediate);
}
public Class getIntermediate() {
return intermediate;
}
public CsvFieldMapperTriBuilder> field(String name) {
return new CsvFieldMapperTriBuilder>(this, name, intermediate);
}
public DoubleCsvFieldMapperTriBuilder> doubleField(String name) {
return new DoubleCsvFieldMapperTriBuilder>(this, name, intermediate);
}
public LongCsvFieldMapperTriBuilder> longField(String name) {
return new LongCsvFieldMapperTriBuilder>(this, name, intermediate);
}
public IntCsvFieldMapperTriBuilder> integerField(String name) {
return new IntCsvFieldMapperTriBuilder>(this, name, intermediate);
}
public BooleanCsvFieldMapperTriBuilder> booleanField(String name) {
return new BooleanCsvFieldMapperTriBuilder>(this, name, intermediate);
}
}