Skip to content

Commit bea69cd

Browse files
committed
Javadoc: Use {@code ...} in pre tags
1 parent 28441e6 commit bea69cd

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

src/main/java/org/apache/commons/csv/CSVFormat.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,19 @@
8989
* You can extend a format by calling the {@code set} methods. For example:
9090
* </p>
9191
*
92-
* <pre>
93-
* CSVFormat.EXCEL.withNullString(&quot;N/A&quot;).withIgnoreSurroundingSpaces(true);
94-
* </pre>
92+
* <pre>{@code
93+
* CSVFormat.EXCEL.withNullString("N/A").withIgnoreSurroundingSpaces(true);
94+
* }</pre>
9595
*
9696
* <h2>Defining column names</h2>
9797
*
9898
* <p>
9999
* To define the column names you want to use to access records, write:
100100
* </p>
101101
*
102-
* <pre>
103-
* CSVFormat.EXCEL.withHeader(&quot;Col1&quot;, &quot;Col2&quot;, &quot;Col3&quot;);
104-
* </pre>
102+
* <pre>{@code
103+
* CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3");
104+
* }</pre>
105105
*
106106
* <p>
107107
* 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
@@ -117,10 +117,10 @@
117117
* You can use a format directly to parse a reader. For example, to parse an Excel file with columns header, write:
118118
* </p>
119119
*
120-
* <pre>
120+
* <pre>{@code
121121
* Reader in = ...;
122-
* CSVFormat.EXCEL.withHeader(&quot;Col1&quot;, &quot;Col2&quot;, &quot;Col3&quot;).parse(in);
123-
* </pre>
122+
* CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3").parse(in);
123+
* }</pre>
124124
*
125125
* <p>
126126
* For other input types, like resources, files, and URLs, use the static methods on {@link CSVParser}.
@@ -143,9 +143,9 @@
143143
* Then, call one of the {@link CSVRecord} get method that takes a String column name argument:
144144
* </p>
145145
*
146-
* <pre>
147-
* String value = record.get(&quot;Col1&quot;);
148-
* </pre>
146+
* <pre>{@code
147+
* String value = record.get("Col1");
148+
* }</pre>
149149
*
150150
* <p>
151151
* This makes your code impervious to changes in column order in the CSV file.
@@ -558,9 +558,9 @@ public Builder setHeader(final ResultSetMetaData resultSetMetaData) throws SQLEx
558558
*
559559
* or specified manually with:
560560
*
561-
* <pre>
562-
* builder.setHeader(&quot;name&quot;, &quot;email&quot;, &quot;phone&quot;);
563-
* </pre>
561+
* <pre>{@code
562+
* builder.setHeader("name", "email", "phone");
563+
* }</pre>
564564
* <p>
565565
* The header is also used by the {@link CSVPrinter}.
566566
* </p>
@@ -2813,9 +2813,9 @@ public CSVFormat withHeader(final ResultSetMetaData resultSetMetaData) throws SQ
28132813
*
28142814
* or specified manually with:
28152815
*
2816-
* <pre>
2817-
* CSVFormat format = aformat.withHeader(&quot;name&quot;, &quot;email&quot;, &quot;phone&quot;);
2818-
* </pre>
2816+
* <pre>{@code
2817+
* CSVFormat format = aformat.withHeader("name", "email", "phone");
2818+
* }</pre>
28192819
* <p>
28202820
* The header is also used by the {@link CSVPrinter}.
28212821
* </p>
@@ -2834,9 +2834,9 @@ public CSVFormat withHeader(final String... header) {
28342834
* 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.
28352835
* This setting is ignored by the parser.
28362836
*
2837-
* <pre>
2838-
* CSVFormat format = aformat.withHeaderComments(&quot;Generated by Apache Commons CSV.&quot;, Instant.now());
2839-
* </pre>
2837+
* <pre>{@code
2838+
* CSVFormat format = aformat.withHeaderComments("Generated by Apache Commons CSV.", Instant.now());
2839+
* }</pre>
28402840
*
28412841
* @param headerComments the headerComments which will be printed by the Printer before the actual CSV data.
28422842
* @return A new CSVFormat that is equal to this but with the specified header

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@
8282
* To parse a CSV input from a file, you write:
8383
* </p>
8484
*
85-
* <pre>
86-
* File csvData = new File(&quot;/path/to/csv&quot;);
85+
* <pre>{@code
86+
* File csvData = new File("/path/to/csv");
8787
* CSVParser parser = CSVParser.parse(csvData, CSVFormat.RFC4180);
8888
* for (CSVRecord csvRecord : parser) {
8989
* ...
90-
* }
90+
* }}
9191
* </pre>
9292
*
9393
* <p>
@@ -116,11 +116,11 @@
116116
* If parsing record-wise is not desired, the contents of the input can be read completely into memory.
117117
* </p>
118118
*
119-
* <pre>
120-
* Reader in = new StringReader(&quot;a;b\nc;d&quot;);
119+
* <pre>{@code
120+
* Reader in = new StringReader("a;b\nc;d");
121121
* CSVParser parser = new CSVParser(in, CSVFormat.EXCEL);
122-
* List&lt;CSVRecord&gt; list = parser.getRecords();
123-
* </pre>
122+
* List<CSVRecord> list = parser.getRecords();
123+
* }</pre>
124124
*
125125
* <p>
126126
* There are two constraints that have to be kept in mind:

src/main/java/org/apache/commons/csv/CSVPrinter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public void printRecords(final ResultSet resultSet, final boolean printHeader) t
464464
* data.add(new String[]{ "A", "B", "C" });
465465
* data.add(new String[]{ "1", "2", "3" });
466466
* data.add(new String[]{ "A1", "B2", "C3" });
467-
* Stream&lt;String[]&gt; stream = data.stream();
467+
* Stream<String[]> stream = data.stream();
468468
* }
469469
* </pre>
470470
*

0 commit comments

Comments
 (0)