Skip to content
Permalink
Browse files
renaming readHeaders writeHeaders for CommonsCsvWriter for consistency
  • Loading branch information
Romain Manni-Bucau committed Nov 24, 2015
1 parent 6047c39 commit ef9bfa9baaeaea5c115aa2f64d9f81e065606c6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
@@ -109,7 +109,7 @@ public class CommonsCsvWriter implements ItemWriter {

@Inject
@BatchProperty
private String readHeaders;
private String writeHeaders;

private CSVPrinter writer;
private BeanLocator.LocatorInstance<CsvWriterMapper> mapperInstance;
@@ -122,7 +122,7 @@ public void open(final Serializable checkpoint) throws Exception {
(defaultMapper != null ? new BeanLocator.LocatorInstance<CsvWriterMapper>(defaultMapper, null) : null) :
BeanLocator.Finder.get(locator).newInstance(CsvWriterMapper.class, mapper);

if ((header == null || header.isEmpty()) && Boolean.parseBoolean(readHeaders) && DefaultMapper.class.isInstance(mapperInstance.getValue())) {
if ((header == null || header.isEmpty()) && Boolean.parseBoolean(writeHeaders) && DefaultMapper.class.isInstance(mapperInstance.getValue())) {
header = toListString(DefaultMapper.class.cast(mapperInstance.getValue()).getHeaders());
}
final CSVFormat format = newFormat();
@@ -178,7 +178,7 @@ protected CSVFormat newFormat() {
return CSVFormatFactory.newFormat(
format, delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter, ignoreSurroundingSpaces,
ignoreEmptyLines, recordSeparator, nullString, headerComments, header, skipHeaderRecord, allowMissingColumnNames,
readHeaders);
writeHeaders);
}

public void setFormat(final String format) {
@@ -261,11 +261,11 @@ public void setSkipHeaderRecord(final String skipHeaderRecord) {
this.skipHeaderRecord = skipHeaderRecord;
}

public void setReadHeaders(final String readHeaders) {
this.readHeaders = readHeaders;
public void setWriteHeaders(final String readHeaders) {
this.writeHeaders = readHeaders;
}

public void readHeaders() {
this.readHeaders = "true";
public void writeHeaders() {
this.writeHeaders = "true";
}
}
@@ -21,7 +21,7 @@
<properties>
<property name="output" value="#{jobParameters['output']}"/>
<property name="mapping" value="org.apache.batchee.csv.CommonsCsvWriterMappingHeadersTest$Record"/>
<property name="readHeaders" value="true"/>
<property name="writeHeaders" value="true"/>
</properties>
</writer>
</chunk>

0 comments on commit ef9bfa9

Please sign in to comment.