public static class CsvValueDecorators.StringPrefixSuffixDecorator extends Object implements CsvValueDecorator
StringPrefixSuffixDecorator(java.lang.String, java.lang.String, boolean)).| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_optional
Whether existence of prefix and suffix decoration is optional
(
true) or required (false): if required
and value does does not have decorations, deserialization (reading)
will fail with an exception; if optional value is exposed as is. |
protected String |
_prefix
Decoration added before value being decorated: for example, if decorating
with brackets, this would be opening bracket
[ . |
protected String |
_suffix
Decoration added after value being decorated: for example, if decorating
with brackets, this would be closing bracket
] . |
| Constructor and Description |
|---|
StringPrefixSuffixDecorator(String prefix,
String suffix,
boolean optional) |
| Modifier and Type | Method and Description |
|---|---|
String |
decorateValue(CsvGenerator gen,
String plainValue)
Method called during serialization when encoding a value,
to produce "decorated" value to include in output (possibly
escaped and/or quoted).
|
String |
undecorateValue(CsvParser parser,
String decoratedValue)
Method called during deserialization, to remove possible decoration
applied with
CsvValueDecorator.decorateValue(com.fasterxml.jackson.dataformat.csv.CsvGenerator, java.lang.String). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecorateNullprotected final String _prefix
[ .protected final String _suffix
] .protected final boolean _optional
true) or required (false): if required
and value does does not have decorations, deserialization (reading)
will fail with an exception; if optional value is exposed as is.public String decorateValue(CsvGenerator gen, String plainValue) throws IOException
CsvValueDecoratorCsvSchema is applied on decorated value.decorateValue in interface CsvValueDecoratorgen - Generator that will be used for actual serializationplainValue - Value to decorateplainValue as-is) but
Must Not be nullIOException - if attempt to decorate the value somehow fails
(typically a StreamWriteException)public String undecorateValue(CsvParser parser, String decoratedValue) throws IOException
CsvValueDecoratorCsvValueDecorator.decorateValue(com.fasterxml.jackson.dataformat.csv.CsvGenerator, java.lang.String).
Call is made after textual value for a cell (column
value) has been read using parser and after removing (decoding)
possible quoting and/or escaping of the value. Value passed in
has no escaping or quoting left.undecorateValue in interface CsvValueDecoratorparser - Parser that was used to decode textual value from inputdecoratedValue - Value from which to remove decorations, if any
(some decorators can allow optional decorations; others may fail
if none found)IOException - if attempt to un-decorate the value fails
(typically a StreamReadException)Copyright © 2025 FasterXML. All rights reserved.