You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/09/06 20:53:21 UTC

[GitHub] [commons-csv] kinow commented on a diff in pull request #257: [CSV-304] Accessors for header/trailer comments

kinow commented on code in PR #257:
URL: https://github.com/apache/commons-csv/pull/257#discussion_r964097158


##########
src/main/java/org/apache/commons/csv/CSVParser.java:
##########
@@ -596,7 +601,49 @@ Map<String, Integer> getHeaderMapRaw() {
     public List<String> getHeaderNames() {
         return Collections.unmodifiableList(headers.headerNames);
     }
-
+    /**
+     * Checks whether this parser has a header comment, false otherwise.
+     * The header comment appears before the header record.
+     * Note that if the parser's format has been given an explicit header
+     * (with {@link CSVFormat.Builder#setHeader(String... )} or another overload)
+     * and the header record is not being skipped
+     * ({@link CSVFormat.Builder#setSkipHeaderRecord} is false) then any initial comments
+     * will be associated with the first record, not the header.
+     *
+     * @return true if this parser has seen a header comment, false otherwise
+     */
+    public boolean hasHeaderComment() {
+        return headerComment != null;
+    }
+    /**
+     * Returns the header comment for this parser, if any.
+     * The header comment appears before the header record.
+     *
+     * @return the header comment for this stream, or null if no comment is available.
+     */
+    public String getHeaderComment() {
+        return headerComment;
+    }
+    /**
+     * Checks whether this parser has seen a trailer comment, false otherwise.
+     * Trailer comments are located between the last record and EOF.
+     * The trailer comments will only be available after the parser has
+     * finished processing this stream.
+     *
+     * @return true if this parser has seen a trailer comment, false otherwise
+     */
+    public boolean hasTrailerComment() {
+        return trailerComment != null;
+    }
+    /**
+     * Returns the trailer comment for this record, if any.
+     * Trailer comments are located between the last record and EOF
+     *
+     * @return the trailer comment for this stream, or null if no comment is available.
+     */
+    public String getTrailerComment() {
+        return trailerComment;
+    }

Review Comment:
   New public methods need a `@since ` tag with the version. The version is the `version-SNAPSHOT` from the `pom.xml`, without the `-SNAPSHOT` suffix (i.e. next release version).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org