From bea69cd60e3b16a864255f4facf4a2fb00fc8bd3 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 14 Sep 2024 11:47:16 -0400 Subject: [PATCH] Javadoc: Use {@code ...} in pre tags --- .../org/apache/commons/csv/CSVFormat.java | 42 +++++++++---------- .../org/apache/commons/csv/CSVParser.java | 14 +++---- .../org/apache/commons/csv/CSVPrinter.java | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java index b9499464..6c7317f2 100644 --- a/src/main/java/org/apache/commons/csv/CSVFormat.java +++ b/src/main/java/org/apache/commons/csv/CSVFormat.java @@ -89,9 +89,9 @@ import org.apache.commons.io.output.AppendableOutputStream; * You can extend a format by calling the {@code set} methods. For example: *

* - *
- * CSVFormat.EXCEL.withNullString("N/A").withIgnoreSurroundingSpaces(true);
- * 
+ *
{@code
+ * CSVFormat.EXCEL.withNullString("N/A").withIgnoreSurroundingSpaces(true);
+ * }
* *

Defining column names

* @@ -99,9 +99,9 @@ import org.apache.commons.io.output.AppendableOutputStream; * To define the column names you want to use to access records, write: *

* - *
- * CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3");
- * 
+ *
{@code
+ * CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3");
+ * }
* *

* 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 @@ import org.apache.commons.io.output.AppendableOutputStream; * You can use a format directly to parse a reader. For example, to parse an Excel file with columns header, write: *

* - *
+ * 
{@code
  * Reader in = ...;
- * CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3").parse(in);
- * 
+ * CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3").parse(in); + * }
* *

* For other input types, like resources, files, and URLs, use the static methods on {@link CSVParser}. @@ -143,9 +143,9 @@ import org.apache.commons.io.output.AppendableOutputStream; * Then, call one of the {@link CSVRecord} get method that takes a String column name argument: *

* - *
- * String value = record.get("Col1");
- * 
+ *
{@code
+ * String value = record.get("Col1");
+ * }
* *

* This makes your code impervious to changes in column order in the CSV file. @@ -558,9 +558,9 @@ public final class CSVFormat implements Serializable { * * or specified manually with: * - *

-         * builder.setHeader("name", "email", "phone");
-         * 
+ *
{@code
+         * builder.setHeader("name", "email", "phone");
+         * }
*

* The header is also used by the {@link CSVPrinter}. *

@@ -2813,9 +2813,9 @@ public final class CSVFormat implements Serializable { * * or specified manually with: * - *
-     * CSVFormat format = aformat.withHeader("name", "email", "phone");
-     * 
+ *
{@code
+     * CSVFormat format = aformat.withHeader("name", "email", "phone");
+     * }
*

* The header is also used by the {@link CSVPrinter}. *

@@ -2834,9 +2834,9 @@ public final class CSVFormat implements Serializable { * 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. * - *
-     * CSVFormat format = aformat.withHeaderComments("Generated by Apache Commons CSV.", Instant.now());
-     * 
+ *
{@code
+     * CSVFormat format = aformat.withHeaderComments("Generated by Apache Commons CSV.", Instant.now());
+     * }
* * @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 diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java index 626af387..471a43c1 100644 --- a/src/main/java/org/apache/commons/csv/CSVParser.java +++ b/src/main/java/org/apache/commons/csv/CSVParser.java @@ -82,12 +82,12 @@ import org.apache.commons.io.function.Uncheck; * To parse a CSV input from a file, you write: *

* - *
- * File csvData = new File("/path/to/csv");
+ * 
{@code
+ * File csvData = new File("/path/to/csv");
  * CSVParser parser = CSVParser.parse(csvData, CSVFormat.RFC4180);
  * for (CSVRecord csvRecord : parser) {
  *     ...
- * }
+ * }}
  * 
* *

@@ -116,11 +116,11 @@ import org.apache.commons.io.function.Uncheck; * If parsing record-wise is not desired, the contents of the input can be read completely into memory. *

* - *
- * Reader in = new StringReader("a;b\nc;d");
+ * 
{@code
+ * Reader in = new StringReader("a;b\nc;d");
  * CSVParser parser = new CSVParser(in, CSVFormat.EXCEL);
- * List<CSVRecord> list = parser.getRecords();
- * 
+ * List list = parser.getRecords(); + * }
* *

* There are two constraints that have to be kept in mind: diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java index 1ca8e4f6..77ae61a8 100644 --- a/src/main/java/org/apache/commons/csv/CSVPrinter.java +++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java @@ -464,7 +464,7 @@ public final class CSVPrinter implements Flushable, Closeable { * data.add(new String[]{ "A", "B", "C" }); * data.add(new String[]{ "1", "2", "3" }); * data.add(new String[]{ "A1", "B2", "C3" }); - * Stream<String[]> stream = data.stream(); + * Stream stream = data.stream(); * } *

*