Merge pull request #344 from gbidsilva/javaDocOptimization

[Javadoc] CSVFormat#setHeaderComments()
This commit is contained in:
Gary Gregory 2023-08-25 09:35:59 -04:00 committed by GitHub
commit 082827ceef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 55 additions and 8 deletions

View File

@ -521,28 +521,75 @@ public final class CSVFormat implements Serializable {
} }
/** /**
* Sets the header comments set to the given values. The comments will be printed first, before the headers. This setting is ignored by the parser. * Sets the header comments to the given values before the CSV data.
* * <p>
* This setting is ignored by the parser.
* </p>
* <p>
* Comments are printed first, before headers.
* </p>
* <p>
* Use {@link Builder#setCommentMarker(char)} or {@link Builder#setCommentMarker(Character)} to set the comment marker written at the start of
* each comment line.
* </p>
* <p>
* If the comment marker is not set, then the header comments are ignored.
* </p>
* <p>
* For example:
* </p>
* <pre> * <pre>
* builder.setHeaderComments(&quot;Generated by Apache Commons CSV.&quot;, Instant.now()); * builder.setCommentMarker('#')
* .setHeaderComments("Generated by Apache Commons CSV", Instant.ofEpochMilli(0));
* </pre>
* <p>
* writes:
* </p>
* <pre>
* # Generated by Apache Commons CSV.
* # 1970-01-01T00:00:00Z
* </pre> * </pre>
* *
* @param headerComments the headerComments which will be printed by the Printer before the actual CSV data. * @param headerComments the headerComments which will be printed by the Printer before the CSV data.
* @return This instance. * @return This instance.
*/ */
public Builder setHeaderComments(final Object... headerComments) { public Builder setHeaderComments(final Object... headerComments) {
this.headerComments = CSVFormat.clone(toStringArray(headerComments)); this.headerComments = CSVFormat.clone(toStringArray(headerComments));
return this; return this;
} }
/** /**
* Sets the header comments set to the given values. The comments will be printed first, before the headers. This setting is ignored by the parser. * Sets the header comments to the given values before the CSV data.
* * <p>
* This setting is ignored by the parser.
* </p>
* <p>
* Comments are printed first, before headers.
* </p>
* <p>
* Use {@link Builder#setCommentMarker(char)} or {@link Builder#setCommentMarker(Character)} to set the comment marker written at the start of
* each comment line.
* </p>
* <p>
* If the comment marker is not set, then the header comments are ignored.
* </p>
* <p>
* For example:
* </p>
* <pre> * <pre>
* Builder.setHeaderComments(&quot;Generated by Apache Commons CSV.&quot;, Instant.now()); * builder.setCommentMarker('#')
* .setHeaderComments("Generated by Apache Commons CSV", Instant.ofEpochMilli(0).toString());
* </pre>
* <p>
* writes:
* </p>
* <pre>
* # Generated by Apache Commons CSV.
* # 1970-01-01T00:00:00Z
* </pre> * </pre>
* *
* @param headerComments the headerComments which will be printed by the Printer before the actual CSV data. * @param headerComments the headerComments which will be printed by the Printer before the CSV data.
* @return This instance. * @return This instance.
*/ */
public Builder setHeaderComments(final String... headerComments) { public Builder setHeaderComments(final String... headerComments) {