Top Description Inners Fields Constructors Methods
tools.jackson.dataformat.csv

public Class CsvValueDecorators

extends Object
Class Inheritance
Imports
java.util.Objects, tools.jackson.core.JacksonException

Container class for default CsvValueDecorator implementations
Since
2.18

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
CsvValueDecorators.StringPrefixSuffixDecorator

Decorated that adds static prefix and suffix around value to decorate value; removes the same when un-decorating.

Field Summary

Modifier and TypeField and Description
public static final CsvValueDecorator
OPTIONAL_BRACKETS_DECORATOR

StringPrefixSuffixDecorator that uses square brackets ([]) around decorated value, but does not require their use (removes if used, ignores it not).

public static final CsvValueDecorator
STRICT_BRACKETS_DECORATOR

StringPrefixSuffixDecorator that uses square brackets ([]) around decorated value, and requires their use (if value has no matching decoration, an exception is thrown when attempting to read the value).

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static CsvValueDecorator
optionalPrefixSuffixDecorator(String prefix, String suffix)

Factory method for constructing a StringPrefixSuffixDecorator with given prefix and suffix, both optional.

public static CsvValueDecorator
requiredPrefixSuffixDecorator(String prefix, String suffix)

Factory method for constructing a StringPrefixSuffixDecorator with given prefix and suffix, both required.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

OPTIONAL_BRACKETS_DECORATORback to summary
public static final CsvValueDecorator OPTIONAL_BRACKETS_DECORATOR

StringPrefixSuffixDecorator that uses square brackets ([]) around decorated value, but does not require their use (removes if used, ignores it not).

STRICT_BRACKETS_DECORATORback to summary
public static final CsvValueDecorator STRICT_BRACKETS_DECORATOR

StringPrefixSuffixDecorator that uses square brackets ([]) around decorated value, and requires their use (if value has no matching decoration, an exception is thrown when attempting to read the value).

Constructor Detail

CsvValueDecoratorsback to summary
public CsvValueDecorators()

Method Detail

optionalPrefixSuffixDecoratorback to summary
public static CsvValueDecorator optionalPrefixSuffixDecorator(String prefix, String suffix)

Factory method for constructing a StringPrefixSuffixDecorator with given prefix and suffix, both optional.

requiredPrefixSuffixDecoratorback to summary
public static CsvValueDecorator requiredPrefixSuffixDecorator(String prefix, String suffix)

Factory method for constructing a StringPrefixSuffixDecorator with given prefix and suffix, both required.

tools.jackson.dataformat.csv back to summary

public Class CsvValueDecorators.StringPrefixSuffixDecorator

extends Object
implements CsvValueDecorator
Class Inheritance
  • java.lang.Object
  • tools.jackson.dataformat.csv.CsvValueDecorators.StringPrefixSuffixDecorator
All Implemented Interfaces
tools.jackson.dataformat.csv.CsvValueDecorator

Decorated that adds static prefix and suffix around value to decorate value; removes the same when un-decorating. Handling of the case where decoration is missing on deserialization (reading) depends on where decorator is created with "optional" or "strict" setting (see StringPrefixSuffixDecorator#StringPrefixSuffixDecorator).

Field Summary

Modifier and TypeField and Description
protected final 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 final String
_prefix

Decoration added before value being decorated: for example, if decorating with brackets, this would be opening bracket [ .

protected final String
_suffix

Decoration added after value being decorated: for example, if decorating with brackets, this would be closing bracket ] .

Constructor Summary

AccessConstructor and Description
public
StringPrefixSuffixDecorator(String prefix, String suffix, boolean optional)

Method Summary

Modifier and TypeMethod and Description
public String
decorateValue(CsvGenerator gen, String plainValue)

Implements tools.jackson.dataformat.csv.CsvValueDecorator.decorateValue.

Method called during serialization when encoding a value, to produce "decorated" value to include in output (possibly escaped and/or quoted).

public String
undecorateValue(CsvParser parser, String decoratedValue)

Implements tools.jackson.dataformat.csv.CsvValueDecorator.undecorateValue.

Method called during deserialization, to remove possible decoration applied with decorateValue.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_optionalback to summary
protected final 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.

_prefixback to summary
protected final String _prefix

Decoration added before value being decorated: for example, if decorating with brackets, this would be opening bracket [ .

_suffixback to summary
protected final String _suffix

Decoration added after value being decorated: for example, if decorating with brackets, this would be closing bracket ] .

Constructor Detail

StringPrefixSuffixDecoratorback to summary
public StringPrefixSuffixDecorator(String prefix, String suffix, boolean optional)

Method Detail

decorateValueback to summary
public String decorateValue(CsvGenerator gen, String plainValue) throws JacksonException

Implements tools.jackson.dataformat.csv.CsvValueDecorator.decorateValue.

Doc from tools.jackson.dataformat.csv.CsvValueDecorator.decorateValue.

Method called during serialization when encoding a value, to produce "decorated" value to include in output (possibly escaped and/or quoted). Note that possible escaping and/or quoting (as per configuration of CsvSchema is applied on decorated value.

Annotations
@Override
Exceptions
JacksonException:
if attempt to decorate the value somehow fails
undecorateValueback to summary
public String undecorateValue(CsvParser parser, String decoratedValue) throws JacksonException

Implements tools.jackson.dataformat.csv.CsvValueDecorator.undecorateValue.

Doc from tools.jackson.dataformat.csv.CsvValueDecorator.undecorateValue.

Method called during deserialization, to remove possible decoration applied with decorateValue. 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.

Annotations
@Override
Exceptions
JacksonException:
if attempt to un-decorate the value fails