mirror of
https://github.com/apache/commons-csv.git
synced 2025-02-09 19:45:38 +00:00
Change the type of printer API to accept Object instead of String.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398005 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
68322e0336
commit
3be1057064
@ -87,8 +87,8 @@ public class CSVPrinter {
|
|||||||
* @param values
|
* @param values
|
||||||
* values to be outputted.
|
* values to be outputted.
|
||||||
*/
|
*/
|
||||||
public void println(final String... values) throws IOException {
|
public void println(final Object... values) throws IOException {
|
||||||
for (final String value : values) {
|
for (final Object value : values) {
|
||||||
print(value);
|
print(value);
|
||||||
}
|
}
|
||||||
println();
|
println();
|
||||||
@ -280,15 +280,12 @@ public class CSVPrinter {
|
|||||||
* Prints the string as the next value on the line. The value will be escaped or encapsulated as needed if
|
* Prints the string as the next value on the line. The value will be escaped or encapsulated as needed if
|
||||||
* checkForEscape==true
|
* checkForEscape==true
|
||||||
*
|
*
|
||||||
* @param value
|
* @param object
|
||||||
* value to output.
|
* value to output.
|
||||||
*/
|
*/
|
||||||
public void print(String value, final boolean checkForEscape) throws IOException {
|
public void print(Object object, final boolean checkForEscape) throws IOException {
|
||||||
if (value == null) {
|
// null values are considered empty
|
||||||
// null values are considered empty
|
final String value = object == null ? EMPTY : object.toString();
|
||||||
value = EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkForEscape) {
|
if (!checkForEscape) {
|
||||||
// write directly from string
|
// write directly from string
|
||||||
printDelimiter();
|
printDelimiter();
|
||||||
@ -302,9 +299,9 @@ public class CSVPrinter {
|
|||||||
* Prints the string as the next value on the line. The value will be escaped or encapsulated as needed.
|
* Prints the string as the next value on the line. The value will be escaped or encapsulated as needed.
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value
|
||||||
* value to be outputted.
|
* value to be output.
|
||||||
*/
|
*/
|
||||||
public void print(final String value) throws IOException {
|
public void print(final Object value) throws IOException {
|
||||||
print(value, true);
|
print(value, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user