Skip to content

Commit

Permalink
Javadoc: Use {@code ...} in pre tags
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Sep 14, 2024
1 parent 28441e6 commit bea69cd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
42 changes: 21 additions & 21 deletions src/main/java/org/apache/commons/csv/CSVFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@
* You can extend a format by calling the {@code set} methods. For example:
* </p>
*
* <pre>
* CSVFormat.EXCEL.withNullString(&quot;N/A&quot;).withIgnoreSurroundingSpaces(true);
* </pre>
* <pre>{@code
* CSVFormat.EXCEL.withNullString("N/A").withIgnoreSurroundingSpaces(true);
* }</pre>
*
* <h2>Defining column names</h2>
*
* <p>
* To define the column names you want to use to access records, write:
* </p>
*
* <pre>
* CSVFormat.EXCEL.withHeader(&quot;Col1&quot;, &quot;Col2&quot;, &quot;Col3&quot;);
* </pre>
* <pre>{@code
* CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3");
* }</pre>
*
* <p>
* Calling {@link Builder#setHeader(String...)} lets you use the given names to address values in a {@link CSVRecord}, and assumes that your CSV source does not
Expand All @@ -117,10 +117,10 @@
* You can use a format directly to parse a reader. For example, to parse an Excel file with columns header, write:
* </p>
*
* <pre>
* <pre>{@code
* Reader in = ...;
* CSVFormat.EXCEL.withHeader(&quot;Col1&quot;, &quot;Col2&quot;, &quot;Col3&quot;).parse(in);
* </pre>
* CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3").parse(in);
* }</pre>
*
* <p>
* For other input types, like resources, files, and URLs, use the static methods on {@link CSVParser}.
Expand All @@ -143,9 +143,9 @@
* Then, call one of the {@link CSVRecord} get method that takes a String column name argument:
* </p>
*
* <pre>
* String value = record.get(&quot;Col1&quot;);
* </pre>
* <pre>{@code
* String value = record.get("Col1");
* }</pre>
*
* <p>
* This makes your code impervious to changes in column order in the CSV file.
Expand Down Expand Up @@ -558,9 +558,9 @@ public Builder setHeader(final ResultSetMetaData resultSetMetaData) throws SQLEx
*
* or specified manually with:
*
* <pre>
* builder.setHeader(&quot;name&quot;, &quot;email&quot;, &quot;phone&quot;);
* </pre>
* <pre>{@code
* builder.setHeader("name", "email", "phone");
* }</pre>
* <p>
* The header is also used by the {@link CSVPrinter}.
* </p>
Expand Down Expand Up @@ -2813,9 +2813,9 @@ public CSVFormat withHeader(final ResultSetMetaData resultSetMetaData) throws SQ
*
* or specified manually with:
*
* <pre>
* CSVFormat format = aformat.withHeader(&quot;name&quot;, &quot;email&quot;, &quot;phone&quot;);
* </pre>
* <pre>{@code
* CSVFormat format = aformat.withHeader("name", "email", "phone");
* }</pre>
* <p>
* The header is also used by the {@link CSVPrinter}.
* </p>
Expand All @@ -2834,9 +2834,9 @@ public CSVFormat withHeader(final String... header) {
* Builds a new {@code CSVFormat} with the header comments of the format set to the given values. The comments will be printed first, before the headers.
* This setting is ignored by the parser.
*
* <pre>
* CSVFormat format = aformat.withHeaderComments(&quot;Generated by Apache Commons CSV.&quot;, Instant.now());
* </pre>
* <pre>{@code
* CSVFormat format = aformat.withHeaderComments("Generated by Apache Commons CSV.", Instant.now());
* }</pre>
*
* @param headerComments the headerComments which will be printed by the Printer before the actual CSV data.
* @return A new CSVFormat that is equal to this but with the specified header
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/apache/commons/csv/CSVParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@
* To parse a CSV input from a file, you write:
* </p>
*
* <pre>
* File csvData = new File(&quot;/path/to/csv&quot;);
* <pre>{@code
* File csvData = new File("/path/to/csv");
* CSVParser parser = CSVParser.parse(csvData, CSVFormat.RFC4180);
* for (CSVRecord csvRecord : parser) {
* ...
* }
* }}
* </pre>
*
* <p>
Expand Down Expand Up @@ -116,11 +116,11 @@
* If parsing record-wise is not desired, the contents of the input can be read completely into memory.
* </p>
*
* <pre>
* Reader in = new StringReader(&quot;a;b\nc;d&quot;);
* <pre>{@code
* Reader in = new StringReader("a;b\nc;d");
* CSVParser parser = new CSVParser(in, CSVFormat.EXCEL);
* List&lt;CSVRecord&gt; list = parser.getRecords();
* </pre>
* List<CSVRecord> list = parser.getRecords();
* }</pre>
*
* <p>
* There are two constraints that have to be kept in mind:
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/csv/CSVPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public void printRecords(final ResultSet resultSet, final boolean printHeader) t
* data.add(new String[]{ "A", "B", "C" });
* data.add(new String[]{ "1", "2", "3" });
* data.add(new String[]{ "A1", "B2", "C3" });
* Stream&lt;String[]&gt; stream = data.stream();
* Stream<String[]> stream = data.stream();
* }
* </pre>
*
Expand Down

0 comments on commit bea69cd

Please sign in to comment.