@@ -152,7 +152,7 @@ public final class CSVFormat implements Serializable {
152152 private final Character commentStart ; // null if commenting is disabled
153153 private final Character escape ; // null if escaping is disabled
154154 private final boolean ignoreSurroundingSpaces ; // Should leading/trailing spaces be ignored around values?
155- private final boolean ignoreEmptyHeaders ;
155+ private final boolean allowMissingColumnNames ;
156156 private final boolean ignoreEmptyLines ;
157157 private final String recordSeparator ; // for outputs
158158 private final String nullString ; // the string to be used for null values
@@ -330,15 +330,15 @@ public static CSVFormat newFormat(final char delimiter) {
330330 * @param header
331331 * the header
332332 * @param skipHeaderRecord TODO
333- * @param ignoreEmptyHeaders TODO
333+ * @param allowMissingColumnNames TODO
334334 * @throws IllegalArgumentException if the delimiter is a line break character
335335 */
336336 private CSVFormat (final char delimiter , final Character quoteChar ,
337337 final Quote quotePolicy , final Character commentStart ,
338338 final Character escape , final boolean ignoreSurroundingSpaces ,
339339 final boolean ignoreEmptyLines , final String recordSeparator ,
340340 final String nullString , final String [] header , final boolean skipHeaderRecord ,
341- final boolean ignoreEmptyHeaders ) {
341+ final boolean allowMissingColumnNames ) {
342342 if (isLineBreak (delimiter )) {
343343 throw new IllegalArgumentException ("The delimiter cannot be a line break" );
344344 }
@@ -348,7 +348,7 @@ private CSVFormat(final char delimiter, final Character quoteChar,
348348 this .commentStart = commentStart ;
349349 this .escape = escape ;
350350 this .ignoreSurroundingSpaces = ignoreSurroundingSpaces ;
351- this .ignoreEmptyHeaders = ignoreEmptyHeaders ;
351+ this .allowMissingColumnNames = allowMissingColumnNames ;
352352 this .ignoreEmptyLines = ignoreEmptyLines ;
353353 this .recordSeparator = recordSeparator ;
354354 this .nullString = nullString ;
@@ -492,13 +492,13 @@ public String[] getHeader() {
492492 }
493493
494494 /**
495- * Specifies whether empty headers are ignored when parsing the header line.
495+ * Specifies whether missing column names are allowed when parsing the header line.
496496 *
497- * @return {@code true} if headers are ignored when parsing the header line, {@code false} to throw an
497+ * @return {@code true} if missing column names are allowed when parsing the header line, {@code false} to throw an
498498 * {@link IllegalArgumentException}.
499499 */
500- public boolean isIgnoringEmptyHeaders () {
501- return ignoreEmptyHeaders ;
500+ public boolean isAllowMissingColumnNames () {
501+ return allowMissingColumnNames ;
502502 }
503503
504504 /**
@@ -772,7 +772,7 @@ public CSVFormat withCommentMarker(final Character commentMarker) {
772772 }
773773 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentMarker , escape ,
774774 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
775- ignoreEmptyHeaders );
775+ allowMissingColumnNames );
776776 }
777777
778778 /**
@@ -790,7 +790,7 @@ public CSVFormat withDelimiter(final char delimiter) {
790790 }
791791 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
792792 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
793- ignoreEmptyHeaders );
793+ allowMissingColumnNames );
794794 }
795795
796796 /**
@@ -821,7 +821,7 @@ public CSVFormat withEscape(final Character escape) {
821821 }
822822 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
823823 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
824- ignoreEmptyHeaders );
824+ allowMissingColumnNames );
825825 }
826826
827827 /**
@@ -844,21 +844,21 @@ public CSVFormat withEscape(final Character escape) {
844844 public CSVFormat withHeader (final String ... header ) {
845845 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
846846 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
847- ignoreEmptyHeaders );
847+ allowMissingColumnNames );
848848 }
849849
850850 /**
851- * Sets the empty header behavior of the format.
851+ * Sets the missing column names behavior of the format.
852852 *
853- * @param ignoreEmptyHeaders
854- * the empty header behavior, {@code true} to ignore empty headers in the header line,
853+ * @param allowMissingColumnNames
854+ * the missing column names behavior, {@code true} to allow missing column names in the header line,
855855 * {@code false} to cause an {@link IllegalArgumentException} to be thrown.
856- * @return A new CSVFormat that is equal to this but with the specified empty header behavior.
856+ * @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
857857 */
858- public CSVFormat withIgnoreEmptyHeaders (final boolean ignoreEmptyHeaders ) {
858+ public CSVFormat withAllowMissingColumnNames (final boolean allowMissingColumnNames ) {
859859 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
860- ignoreSurroundingSpaces , ignoreEmptyHeaders , recordSeparator , nullString , header , skipHeaderRecord ,
861- ignoreEmptyHeaders );
860+ ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
861+ allowMissingColumnNames );
862862 }
863863
864864 /**
@@ -872,7 +872,7 @@ public CSVFormat withIgnoreEmptyHeaders(final boolean ignoreEmptyHeaders) {
872872 public CSVFormat withIgnoreEmptyLines (final boolean ignoreEmptyLines ) {
873873 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
874874 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
875- ignoreEmptyHeaders );
875+ allowMissingColumnNames );
876876 }
877877
878878 /**
@@ -886,7 +886,7 @@ public CSVFormat withIgnoreEmptyLines(final boolean ignoreEmptyLines) {
886886 public CSVFormat withIgnoreSurroundingSpaces (final boolean ignoreSurroundingSpaces ) {
887887 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
888888 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
889- ignoreEmptyHeaders );
889+ allowMissingColumnNames );
890890 }
891891
892892 /**
@@ -907,7 +907,7 @@ public CSVFormat withIgnoreSurroundingSpaces(final boolean ignoreSurroundingSpac
907907 public CSVFormat withNullString (final String nullString ) {
908908 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
909909 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
910- ignoreEmptyHeaders );
910+ allowMissingColumnNames );
911911 }
912912
913913 /**
@@ -938,7 +938,7 @@ public CSVFormat withQuoteChar(final Character quoteChar) {
938938 }
939939 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
940940 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
941- ignoreEmptyHeaders );
941+ allowMissingColumnNames );
942942 }
943943
944944 /**
@@ -952,7 +952,7 @@ public CSVFormat withQuoteChar(final Character quoteChar) {
952952 public CSVFormat withQuotePolicy (final Quote quotePolicy ) {
953953 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
954954 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
955- ignoreEmptyHeaders );
955+ allowMissingColumnNames );
956956 }
957957
958958 /**
@@ -986,7 +986,7 @@ public CSVFormat withRecordSeparator(final char recordSeparator) {
986986 public CSVFormat withRecordSeparator (final String recordSeparator ) {
987987 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
988988 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
989- ignoreEmptyHeaders );
989+ allowMissingColumnNames );
990990 }
991991
992992 /**
@@ -1001,6 +1001,6 @@ public CSVFormat withRecordSeparator(final String recordSeparator) {
10011001 public CSVFormat withSkipHeaderRecord (final boolean skipHeaderRecord ) {
10021002 return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
10031003 ignoreSurroundingSpaces , ignoreEmptyLines , recordSeparator , nullString , header , skipHeaderRecord ,
1004- ignoreEmptyHeaders );
1004+ allowMissingColumnNames );
10051005 }
10061006}
0 commit comments