Modifier and Type | Field and Description |
---|---|
protected String |
_anyPropertyName
If "any properties" (properties for 'extra' columns; ones
not specified in schema) are enabled, they are mapped to
this name: leaving it as
null disables use of
"any properties" (and they are either ignored, or an exception
is thrown, depending on other settings); setting it to a non-null
String value will expose all extra properties under one specified
name. |
protected String |
_arrayElementSeparator |
protected ArrayList<CsvSchema.Column> |
_columns |
protected char |
_columnSeparator |
protected int |
_encodingFeatures
Bit-flag for general-purpose on/off features.
|
protected int |
_escapeChar |
protected char[] |
_lineSeparator |
protected char[] |
_nullValue |
protected int |
_quoteChar |
Constructor and Description |
---|
Builder() |
Builder(CsvSchema src)
"Copy" constructor which creates builder that has settings of
given source schema
|
Modifier and Type | Method and Description |
---|---|
protected void |
_checkIndex(int index) |
protected void |
_feature(int feature,
boolean state) |
CsvSchema.Builder |
addArrayColumn(String name) |
CsvSchema.Builder |
addArrayColumn(String name,
int elementSeparator)
Deprecated.
use
addArrayColumn(String, String) instead |
CsvSchema.Builder |
addArrayColumn(String name,
String elementSeparator) |
CsvSchema.Builder |
addBooleanColumn(String name) |
CsvSchema.Builder |
addColumn(CsvSchema.Column c)
NOTE: does NOT check for duplicate column names so it is possibly to
accidentally add duplicates.
|
CsvSchema.Builder |
addColumn(String name)
NOTE: does NOT check for duplicate column names so it is possibly to
accidentally add duplicates.
|
CsvSchema.Builder |
addColumn(String name,
CsvSchema.ColumnType type)
NOTE: does NOT check for duplicate column names so it is possibly to
accidentally add duplicates.
|
CsvSchema.Builder |
addColumns(Iterable<CsvSchema.Column> cs)
NOTE: does NOT check for duplicate column names so it is possibly to
accidentally add duplicates.
|
CsvSchema.Builder |
addColumns(Iterable<String> names,
CsvSchema.ColumnType type)
NOTE: does NOT check for duplicate column names so it is possibly to
accidentally add duplicates.
|
CsvSchema.Builder |
addColumnsFrom(CsvSchema schema)
NOTE: unlike many other add methods, this method DOES check for, and
discard, possible duplicate columns: that is, if this builder already
has a column with same name as column to be added, existing column
is retained and new column ignored.
|
CsvSchema.Builder |
addNumberColumn(String name) |
CsvSchema |
build() |
CsvSchema.Builder |
clearColumns() |
CsvSchema.Builder |
disableArrayElementSeparator() |
CsvSchema.Builder |
disableElementSeparator(char c)
Deprecated.
use
disableArrayElementSeparator() instead |
CsvSchema.Builder |
disableEscapeChar()
Method for specifying that no escape character is to be used
with CSV documents this schema defines.
|
CsvSchema.Builder |
disableQuoteChar() |
void |
dropLastColumnIfEmpty()
Helper method called to drop the last collected column name if
it is empty: called if {link CsvParser.Feature#ALLOW_TRAILING_COMMA}
enabled to remove the last entry after being added initially.
|
Iterator<CsvSchema.Column> |
getColumns() |
boolean |
hasColumn(String name)
NOTE: this method requires linear scan over existing columns
so it may be more efficient to use other types of lookups if
available (for example,
CsvSchema.column(String) has a
hash lookup to use). |
CsvSchema.Builder |
removeArrayElementSeparator(int index) |
CsvSchema.Builder |
renameColumn(int index,
String newName) |
CsvSchema.Builder |
replaceColumn(int index,
CsvSchema.Column c) |
CsvSchema.Builder |
setAllowComments(boolean b)
Method for specifying whether Schema should indicate that
"hash comments" (lines where the first non-whitespace character
is '#') are allowed; if so, they will be skipped without processing.
|
CsvSchema.Builder |
setAnyPropertyName(String name) |
CsvSchema.Builder |
setArrayElementSeparator(char c)
Deprecated.
use
setArrayElementSeparator(String) instead |
void |
setArrayElementSeparator(int index,
char sep)
Deprecated.
use
setArrayElementSeparator(String) instead |
CsvSchema.Builder |
setArrayElementSeparator(int index,
String sep) |
CsvSchema.Builder |
setArrayElementSeparator(String separator)
Method for specifying character used to separate array element
values.
|
CsvSchema.Builder |
setColumnSeparator(char c)
Method for specifying character used to separate column
values.
|
CsvSchema.Builder |
setColumnType(int index,
CsvSchema.ColumnType type) |
CsvSchema.Builder |
setEscapeChar(char c)
Method for specifying character used for optional escaping
of characters in quoted String values.
|
CsvSchema.Builder |
setLineSeparator(char lf) |
CsvSchema.Builder |
setLineSeparator(String lf) |
CsvSchema.Builder |
setNullValue(char[] nvl) |
CsvSchema.Builder |
setNullValue(String nvl) |
CsvSchema.Builder |
setQuoteChar(char c)
Method for specifying character used for optional quoting
of values.
|
CsvSchema.Builder |
setReorderColumns(boolean b)
Use in combination with setUseHeader.
|
CsvSchema.Builder |
setSkipFirstDataRow(boolean b)
Method for specifying whether Schema should indicate that
the first line that is not a header (if header handling enabled)
should be skipped in its entirety.
|
CsvSchema.Builder |
setStrictHeaders(boolean b)
Use in combination with
setUseHeader(boolean) . |
CsvSchema.Builder |
setUseHeader(boolean b)
Method for specifying whether Schema should indicate that
a header line (first row that contains column names) is to be
used for reading and writing or not.
|
int |
size() |
protected final ArrayList<CsvSchema.Column> _columns
protected int _encodingFeatures
protected char _columnSeparator
protected String _arrayElementSeparator
protected String _anyPropertyName
null
disables use of
"any properties" (and they are either ignored, or an exception
is thrown, depending on other settings); setting it to a non-null
String value will expose all extra properties under one specified
name.protected int _quoteChar
protected int _escapeChar
protected char[] _lineSeparator
protected char[] _nullValue
public Builder()
public Builder(CsvSchema src)
public CsvSchema.Builder addColumn(String name)
public CsvSchema.Builder addColumn(String name, CsvSchema.ColumnType type)
public CsvSchema.Builder addColumn(CsvSchema.Column c)
public CsvSchema.Builder addColumns(Iterable<CsvSchema.Column> cs)
public CsvSchema.Builder addColumns(Iterable<String> names, CsvSchema.ColumnType type)
public CsvSchema.Builder addColumnsFrom(CsvSchema schema)
public CsvSchema.Builder addArrayColumn(String name)
@Deprecated public CsvSchema.Builder addArrayColumn(String name, int elementSeparator)
addArrayColumn(String, String)
insteadpublic CsvSchema.Builder addArrayColumn(String name, String elementSeparator)
public CsvSchema.Builder addNumberColumn(String name)
public CsvSchema.Builder addBooleanColumn(String name)
public CsvSchema.Builder replaceColumn(int index, CsvSchema.Column c)
public CsvSchema.Builder renameColumn(int index, String newName)
public void dropLastColumnIfEmpty()
public CsvSchema.Builder setColumnType(int index, CsvSchema.ColumnType type)
public CsvSchema.Builder removeArrayElementSeparator(int index)
@Deprecated public void setArrayElementSeparator(int index, char sep)
setArrayElementSeparator(String)
insteadpublic CsvSchema.Builder setArrayElementSeparator(int index, String sep)
public CsvSchema.Builder setAnyPropertyName(String name)
public CsvSchema.Builder clearColumns()
public int size()
public Iterator<CsvSchema.Column> getColumns()
public boolean hasColumn(String name)
NOTE: this method requires linear scan over existing columns
so it may be more efficient to use other types of lookups if
available (for example, CsvSchema.column(String)
has a
hash lookup to use).
public CsvSchema.Builder setUseHeader(boolean b)
public CsvSchema.Builder setReorderColumns(boolean b)
b
- Enable / Disable this settingpublic CsvSchema.Builder setStrictHeaders(boolean b)
setUseHeader(boolean)
. When `strict-headers`
is set, encoder will ensure the headers are in the order
of the schema; if order differs, an exception is thrown.b
- Enable / Disable this settingpublic CsvSchema.Builder setSkipFirstDataRow(boolean b)
public CsvSchema.Builder setAllowComments(boolean b)
protected final void _feature(int feature, boolean state)
public CsvSchema.Builder setColumnSeparator(char c)
@Deprecated public CsvSchema.Builder setArrayElementSeparator(char c)
setArrayElementSeparator(String)
insteadpublic CsvSchema.Builder setArrayElementSeparator(String separator)
@Deprecated public CsvSchema.Builder disableElementSeparator(char c)
disableArrayElementSeparator()
insteadpublic CsvSchema.Builder disableArrayElementSeparator()
public CsvSchema.Builder setQuoteChar(char c)
public CsvSchema.Builder disableQuoteChar()
public CsvSchema.Builder setEscapeChar(char c)
public CsvSchema.Builder disableEscapeChar()
public CsvSchema.Builder setLineSeparator(String lf)
public CsvSchema.Builder setLineSeparator(char lf)
public CsvSchema.Builder setNullValue(String nvl)
public CsvSchema.Builder setNullValue(char[] nvl)
public CsvSchema build()
protected void _checkIndex(int index)
Copyright © 2022 FasterXML. All rights reserved.