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

public final Enum CsvReadFeature

extends Enum<CsvReadFeature>
implements FormatFeature
Class Inheritance
All Implemented Interfaces
tools.jackson.core.FormatFeature, tools.jackson.core.util.JacksonFeature
Imports
tools.jackson.core.FormatFeature

Enumeration that defines all togglable features for CSV parsers

Note

in Jackson 2.x this was named CsvParser.Feature.

Field Summary

Modifier and TypeField and Description
private final boolean
private final int
public static final CsvReadFeature
ALLOW_COMMENTS

Feature that allows accepting "hash comments" by default, similar to CsvSchema#withAllowComments(boolean).

public static final CsvReadFeature
ALLOW_TRAILING_COMMA

Feature that allows there to be a trailing single extraneous data column that is empty.

public static final CsvReadFeature
EMPTY_STRING_AS_NULL

Feature that enables coercing an empty String to `null`.

public static final CsvReadFeature
EMPTY_UNQUOTED_STRING_AS_NULL

Feature that enables coercing an empty un-quoted String to `null`.

public static final CsvReadFeature
FAIL_ON_MISSING_COLUMNS

Feature that allows failing (with a CsvReadException) in cases where number of column values encountered is less than number of columns declared in the active schema ("missing columns").

public static final CsvReadFeature
FAIL_ON_MISSING_HEADER_COLUMNS

Feature that allows failing (with a CsvReadException) in cases where number of header columns encountered is less than number of columns declared in the active schema (if there is one).

public static final CsvReadFeature
IGNORE_TRAILING_UNMAPPABLE

Feature that allows ignoring of unmappable "extra" columns; that is, values for columns that appear after columns for which types are defined.

public static final CsvReadFeature
INSERT_NULLS_FOR_MISSING_COLUMNS

Feature that allows "inserting" virtual key / `null` value pairs in case a row contains fewer columns than declared by configured schema.

public static final CsvReadFeature
SKIP_EMPTY_LINES

Feature that allows skipping input lines that are completely empty or blank (composed only of whitespace), instead of being decoded as lines of just a single column with an empty/blank String value (or, depending on binding, `null`).

public static final CsvReadFeature
TRIM_HEADER_SPACES

Feature determines whether spaces around separator characters (commas) in header line entries (header names) are to be automatically trimmed before being reported or not.

public static final CsvReadFeature
TRIM_SPACES

Feature determines whether spaces around separator characters (commas) are to be automatically trimmed before being reported or not.

public static final CsvReadFeature
WRAP_AS_ARRAY

Feature that determines how stream of records (usually CSV lines, but sometimes multiple lines when line-feeds are included in quoted values) is exposed: either as a sequence of Objects (false), or as an Array of Objects (true).

Constructor Summary

AccessConstructor and Description
private
CsvReadFeature(boolean defaultState)

Method Summary

Modifier and TypeMethod and Description
public static int
collectDefaults()

Method that calculates bit set (flags) of all features that are enabled by default.

public boolean
enabledByDefault()

Implements tools.jackson.core.util.JacksonFeature.enabledByDefault.

Accessor for checking whether this feature is enabled by default.

public boolean
enabledIn(int flags)

Implements tools.jackson.core.util.JacksonFeature.enabledIn.

Convenience method for checking whether feature is enabled in given bitmask.

public int
getMask()

Implements tools.jackson.core.util.JacksonFeature.getMask.

Returns bit mask for this feature instance; must be a single bit, that is of form 1 << N.

public static CsvReadFeature
public static CsvReadFeature[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

_defaultStateback to summary
private final boolean _defaultState
_maskback to summary
private final int _mask
ALLOW_COMMENTSback to summary
public static final CsvReadFeature ALLOW_COMMENTS

Feature that allows accepting "hash comments" by default, similar to CsvSchema#withAllowComments(boolean). If enabled, such comments are by default allowed on all columns of all documents.

ALLOW_TRAILING_COMMAback to summary
public static final CsvReadFeature ALLOW_TRAILING_COMMA

Feature that allows there to be a trailing single extraneous data column that is empty. When this feature is disabled, any extraneous column, regardless of content will cause an exception to be thrown. Disabling this feature is only useful when IGNORE_TRAILING_UNMAPPABLE is also disabled.

EMPTY_STRING_AS_NULLback to summary
public static final CsvReadFeature EMPTY_STRING_AS_NULL

Feature that enables coercing an empty String to `null`.

Note that if this setting is enabled, EMPTY_UNQUOTED_STRING_AS_NULL has no effect. Feature is disabled by default for backwards compatibility.

EMPTY_UNQUOTED_STRING_AS_NULLback to summary
public static final CsvReadFeature EMPTY_UNQUOTED_STRING_AS_NULL

Feature that enables coercing an empty un-quoted String to `null`. This feature allow differentiating between an empty quoted String and an empty un-quoted String.

Note that this feature is only considered if EMPTY_STRING_AS_NULL is disabled.

Feature is disabled by default for backwards compatibility.

FAIL_ON_MISSING_COLUMNSback to summary
public static final CsvReadFeature FAIL_ON_MISSING_COLUMNS

Feature that allows failing (with a CsvReadException) in cases where number of column values encountered is less than number of columns declared in the active schema ("missing columns").

Note that this feature has precedence over INSERT_NULLS_FOR_MISSING_COLUMNS

Feature is disabled by default.

FAIL_ON_MISSING_HEADER_COLUMNSback to summary
public static final CsvReadFeature FAIL_ON_MISSING_HEADER_COLUMNS

Feature that allows failing (with a CsvReadException) in cases where number of header columns encountered is less than number of columns declared in the active schema (if there is one).

Feature is enabled by default.

IGNORE_TRAILING_UNMAPPABLEback to summary
public static final CsvReadFeature IGNORE_TRAILING_UNMAPPABLE

Feature that allows ignoring of unmappable "extra" columns; that is, values for columns that appear after columns for which types are defined. When disabled, an exception is thrown for such column values, but if enabled, they are silently ignored.

Feature is disabled by default.

INSERT_NULLS_FOR_MISSING_COLUMNSback to summary
public static final CsvReadFeature INSERT_NULLS_FOR_MISSING_COLUMNS

Feature that allows "inserting" virtual key / `null` value pairs in case a row contains fewer columns than declared by configured schema. This typically has the effect of forcing an explicit `null` assigment (or corresponding "null value", if so configured) at databinding level. If disabled, no extra work is done and values for "missing" columns are not exposed as part of the token stream.

Note that this feature is only considered if FAIL_ON_MISSING_COLUMNS is disabled.

Feature is disabled by default.

SKIP_EMPTY_LINESback to summary
public static final CsvReadFeature SKIP_EMPTY_LINES

Feature that allows skipping input lines that are completely empty or blank (composed only of whitespace), instead of being decoded as lines of just a single column with an empty/blank String value (or, depending on binding, `null`).

Feature is disabled by default.

TRIM_HEADER_SPACESback to summary
public static final CsvReadFeature TRIM_HEADER_SPACES

Feature determines whether spaces around separator characters (commas) in header line entries (header names) are to be automatically trimmed before being reported or not. Note that this does NOT force trimming of possible white space from within double-quoted values, but only those surrounding unquoted values (white space outside of double-quotes is never included regardless of trimming).

Default value is true.

TRIM_SPACESback to summary
public static final CsvReadFeature TRIM_SPACES

Feature determines whether spaces around separator characters (commas) are to be automatically trimmed before being reported or not. Note that this does NOT force trimming of possible white space from within double-quoted values, but only those surrounding unquoted values (white space outside of double-quotes is never included regardless of trimming).

Default value is false, as per RFC-4180.

WRAP_AS_ARRAYback to summary
public static final CsvReadFeature WRAP_AS_ARRAY

Feature that determines how stream of records (usually CSV lines, but sometimes multiple lines when line-feeds are included in quoted values) is exposed: either as a sequence of Objects (false), or as an Array of Objects (true). Using stream of Objects is convenient when using ObjectMapper.readValues(...) and array of Objects convenient when binding to Lists or arrays of values.

Default value is false, meaning that by default a CSV document is exposed as a sequence of root-level Object entries.

Constructor Detail

CsvReadFeatureback to summary
private CsvReadFeature(boolean defaultState)

Method Detail

collectDefaultsback to summary
public static int collectDefaults()

Method that calculates bit set (flags) of all features that are enabled by default.

enabledByDefaultback to summary
public boolean enabledByDefault()

Implements tools.jackson.core.util.JacksonFeature.enabledByDefault.

Doc from tools.jackson.core.util.JacksonFeature.enabledByDefault.

Accessor for checking whether this feature is enabled by default.

Annotations
@Override
enabledInback to summary
public boolean enabledIn(int flags)

Implements tools.jackson.core.util.JacksonFeature.enabledIn.

Doc from tools.jackson.core.util.JacksonFeature.enabledIn.

Convenience method for checking whether feature is enabled in given bitmask.

Annotations
@Override
getMaskback to summary
public int getMask()

Implements tools.jackson.core.util.JacksonFeature.getMask.

Doc from tools.jackson.core.util.JacksonFeature.getMask.

Returns bit mask for this feature instance; must be a single bit, that is of form 1 << N.

Annotations
@Override
valueOfback to summary
public static CsvReadFeature valueOf(String name)
valuesback to summary
public static CsvReadFeature[] values()