Enum CsvGenerator.Feature
- All Implemented Interfaces:
com.fasterxml.jackson.core.FormatFeature
,com.fasterxml.jackson.core.util.JacksonFeature
,Serializable
,Comparable<CsvGenerator.Feature>
,java.lang.constant.Constable
- Enclosing class:
CsvGenerator
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionFeature that determines whether values written as empty Strings (fromjava.lang.String
valued POJO properties) should be forced to be quoted.Feature that determines whether values written as Nymbers (fromjava.lang.Number
valued POJO properties) should be forced to be quoted, regardless of whether they actually need this.Feature that determines whether values written as Strings (fromjava.lang.String
valued POJO properties) should be forced to be quoted, regardless of whether they actually need this.Feature that determines whether control characters (non-printable) are escaped using the configured escape character.Feature that determines whether quote characters within quoted String values are escaped using configured escape character, instead of being "doubled up" (that is: a quote character is written twice in a row).Feature that determines whether columns without matching value may be omitted, when they are the last values of the row.Feature that determines how much work is done before determining that a column value requires quoting: when set astrue
, full check is made to only use quoting when it is strictly necessary; but whenfalse
, a faster but more conservative check is made, and possibly quoting is used for values that might not need it.Feature that determines whether a line-feed will be written at the end of content, after the last row of output. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
Method that calculates bit set (flags) of all features that are enabled by default.boolean
boolean
enabledIn
(int flags) int
getMask()
static CsvGenerator.Feature
Returns the enum constant of this type with the specified name.static CsvGenerator.Feature[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
STRICT_CHECK_FOR_QUOTING
Feature that determines how much work is done before determining that a column value requires quoting: when set astrue
, full check is made to only use quoting when it is strictly necessary; but whenfalse
, a faster but more conservative check is made, and possibly quoting is used for values that might not need it. Trade-offs is basically between optimal/minimal quoting (true), and possibly faster handling (false). Faster check involves only checking first N characters of value, as well as possible looser checks. However: strict check can also be more efficient in some cases when it allows omitting quoting, so trade-off is not always simple.Note, however, that regardless setting, all values that need to be quoted will be: it is just that when set to
false
, other values may also be quoted (to avoid having to do more expensive checks).Default value is
false
for "loose" (approximate, conservative) checking.- Since:
- 2.4
-
OMIT_MISSING_TAIL_COLUMNS
Feature that determines whether columns without matching value may be omitted, when they are the last values of the row. Iftrue
, values and separators between values may be omitted, to slightly reduce length of the row; iffalse
, separators need to stay in place and values are indicated by empty Strings.- Since:
- 2.4
-
ALWAYS_QUOTE_STRINGS
Feature that determines whether values written as Strings (fromjava.lang.String
valued POJO properties) should be forced to be quoted, regardless of whether they actually need this. Note that this feature has precedence overSTRICT_CHECK_FOR_QUOTING
, when both would be applicable. Note that this setting does NOT affect quoting of typed values likeNumber
s orBoolean
s.- Since:
- 2.5
-
ALWAYS_QUOTE_EMPTY_STRINGS
Feature that determines whether values written as empty Strings (fromjava.lang.String
valued POJO properties) should be forced to be quoted.- Since:
- 2.9
-
ALWAYS_QUOTE_NUMBERS
Feature that determines whether values written as Nymbers (fromjava.lang.Number
valued POJO properties) should be forced to be quoted, regardless of whether they actually need this.- Since:
- 2.16
-
ESCAPE_QUOTE_CHAR_WITH_ESCAPE_CHAR
Feature that determines whether quote characters within quoted String values are escaped using configured escape character, instead of being "doubled up" (that is: a quote character is written twice in a row).Default value is false so that quotes are doubled as necessary, not escaped.
- Since:
- 2.9.3
-
ESCAPE_CONTROL_CHARS_WITH_ESCAPE_CHAR
Feature that determines whether control characters (non-printable) are escaped using the configured escape character. This feature allows LF and CR characters to be output as\n
and\r
instead of being echoed out. This is a compatibility feature for some parsers that can not read such output back in.Default value is false so that control characters are echoed out (backwards compatible).
- Since:
- 2.9.9
-
WRITE_LINEFEED_AFTER_LAST_ROW
Feature that determines whether a line-feed will be written at the end of content, after the last row of output.NOTE! When disabling this feature it is important that
CsvGenerator.flush()
is NOT called beforeCsvGenerator.close()
is called; the current implementation relies on ability to essentially remove the last linefeed that was appended in the output buffer.Default value is
true
so all rows, including the last, are terminated by a line feed.- Since:
- 2.17
-
-
Field Details
-
_defaultState
protected final boolean _defaultState -
_mask
protected final int _mask
-
-
Constructor Details
-
Feature
private Feature(boolean defaultState)
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
collectDefaults
public static int collectDefaults()Method that calculates bit set (flags) of all features that are enabled by default. -
enabledIn
public boolean enabledIn(int flags) - Specified by:
enabledIn
in interfacecom.fasterxml.jackson.core.FormatFeature
- Specified by:
enabledIn
in interfacecom.fasterxml.jackson.core.util.JacksonFeature
-
enabledByDefault
public boolean enabledByDefault()- Specified by:
enabledByDefault
in interfacecom.fasterxml.jackson.core.FormatFeature
- Specified by:
enabledByDefault
in interfacecom.fasterxml.jackson.core.util.JacksonFeature
-
getMask
public int getMask()- Specified by:
getMask
in interfacecom.fasterxml.jackson.core.FormatFeature
- Specified by:
getMask
in interfacecom.fasterxml.jackson.core.util.JacksonFeature
-