Top Description Methods
com.univocity.parsers.common.record

public Interface RecordMetaData

Known Direct Implementers
com.univocity.parsers.common.record.RecordMetaDataImpl
Imports
com.univocity.parsers.common.*, com.univocity.parsers.common.fields.*, com.univocity.parsers.conversions.*

Metadata with information about Records parsed from the input.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the given header name exists in the input records, otherwise false
containsColumn
(String
name of the header
headerName
)

Queries whether a given header name exists in the Records parsed from the input

public <
the enumeration type
T extends Enum<T>
>
FieldSet<T>

Returns:

(modifiable) set of fields to be selected and against which the given conversion sequence will be applied.
convertFields
(Class<T>
the type of the enumeration whose values represent headers in the input Records
enumType
,
Conversion<I, O>...
the sequence of conversions to apply
conversions
)

Associates a sequence of Conversions to fields of a given set of fields

public FieldSet<String>

Returns:

(modifiable) set of fields names to be selected and against which the given conversion sequence will be applied.
convertFields
(Conversion<I, O>...
the sequence of conversions to apply
conversions
)

Associates a sequence of Conversions to fields of a given set of field names

public FieldSet<Integer>

Returns:

(modifiable) set of column indexes to be selected and against which the given conversion sequence will be applied.
convertIndexes
(Conversion<I, O>...
the sequence of conversions to apply
conversions
)

Associates a sequence of Conversions to fields of a given set of column indexes

public Object

Returns:

the default value associated with the given column or null.
defaultValueOf
(Enum<?>
the column whose default value will be returned
column
)

Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))

public Object

Returns:

the default value associated with the given column or null.
defaultValueOf
(String
the column name whose default value will be returned
headerName
)

Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))

public Object

Returns:

the default value associated with the given column or null.
defaultValueOf
(int
the column index whose default value will be returned
columnIndex
)

Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))

public String[]

Returns:

the headers associated with the Records parsed from the input
headers
()

Returns the column names of the Records parsed from the input.

public int

Returns:

index of the given column
indexOf
(Enum<?>
the column whose index will be returned
column
)

Returns the index of a given column

public int

Returns:

index of the given column
indexOf
(String
name of the column whose index will be returned
headerName
)

Returns the index of a given column

public String[]

Returns:

the sequence of selected headers, or all headers if no selection has been made.
selectedHeaders
()

Returns the sequence of headers that have been selected.

public <
type of the default value.
T
>
void
setDefaultValueOfColumns(T
the value to be used for the given column when the parsed result is null
defaultValue
,
Enum<?>...
the columns to be associated with a default value.
columns
)

Associates a default value with one or more columns, in case the values contained are null

public <
type of the default value.
T
>
void
setDefaultValueOfColumns(T
the value to be used for the given column when the parsed result is null
defaultValue
,
String...
the column names to be associated with a default value.
headerNames
)

Associates a default value with one or more columns, in case the values contained are null

public <
type of the default value.
T
>
void
setDefaultValueOfColumns(T
the value to be used for the given column when the parsed result is null
defaultValue
,
int...
the column indexes to be associated with a default value.
columnIndexes
)

Associates a default value with one or more columns, in case the values contained are null

public void
setTypeOfColumns(Class<?>
the type to associate with a list of column
type
,
Enum<E extends Enum<E>>...
the columns that will be associated with the given type.
columns
)

Associates a type with one or more column.

public void
setTypeOfColumns(Class<?>
the type to associate with a list of column
type
,
String...
the columns that will be associated with the given type.
headerNames
)

Associates a type with one or more column.

public void
setTypeOfColumns(Class<?>
the type to associate with a list of column
type
,
int...
the columns that will be associated with the given type.
columnIndexes
)

Associates a type with one or more column.

public Class<?>

Returns:

the type of the given column
typeOf
(Enum<?>
the column whose type will be returned
column
)

Returns the type associated with a given column, defined with the method setTypeOfColumns(type, columns)

public Class<?>

Returns:

the type of the given column
typeOf
(String
name of the column whose type will be returned
headerName
)

Returns the type associated with a given column name, defined with the method setTypeOfColumns(type, columns)

public Class<?>

Returns:

the type of the given column
typeOf
(int
the position of the column whose type will be returned
columnIndex
)

Returns the type associated with a given column, defined with the method setTypeOfColumns(type, columns)

Method Detail

containsColumnback to summary
public boolean containsColumn(String headerName)

Queries whether a given header name exists in the Records parsed from the input

Parameters
headerName:String

name of the header

Returns:boolean

true if the given header name exists in the input records, otherwise false

convertFieldsback to summary
public <T extends Enum<T>> FieldSet<T> convertFields(Class<T> enumType, Conversion<I, O>... conversions)

Associates a sequence of Conversions to fields of a given set of fields

Parameters
<T>
the enumeration type
enumType:Class<T>

the type of the enumeration whose values represent headers in the input Records

conversions:Conversion<I, O>[]

the sequence of conversions to apply

Returns:FieldSet<T>

(modifiable) set of fields to be selected and against which the given conversion sequence will be applied.

Annotations
@SuppressWarnings:rawtypes
convertFieldsback to summary
public FieldSet<String> convertFields(Conversion<I, O>... conversions)

Associates a sequence of Conversions to fields of a given set of field names

Parameters
conversions:Conversion<I, O>[]

the sequence of conversions to apply

Returns:FieldSet<String>

(modifiable) set of fields names to be selected and against which the given conversion sequence will be applied.

Annotations
@SuppressWarnings:rawtypes
convertIndexesback to summary
public FieldSet<Integer> convertIndexes(Conversion<I, O>... conversions)

Associates a sequence of Conversions to fields of a given set of column indexes

Parameters
conversions:Conversion<I, O>[]

the sequence of conversions to apply

Returns:FieldSet<Integer>

(modifiable) set of column indexes to be selected and against which the given conversion sequence will be applied.

Annotations
@SuppressWarnings:rawtypes
defaultValueOfback to summary
public Object defaultValueOf(Enum<?> column)

Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))

Parameters
column:Enum<?>

the column whose default value will be returned

Returns:Object

the default value associated with the given column or null.

defaultValueOfback to summary
public Object defaultValueOf(String headerName)

Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))

Parameters
headerName:String

the column name whose default value will be returned

Returns:Object

the default value associated with the given column or null.

defaultValueOfback to summary
public Object defaultValueOf(int columnIndex)

Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))

Parameters
columnIndex:int

the column index whose default value will be returned

Returns:Object

the default value associated with the given column or null.

headersback to summary
public String[] headers()

Returns the column names of the Records parsed from the input.

If the headers are extracted from the input (i.e. CommonParserSettings#isHeaderExtractionEnabled() == true), then these values will be returned.

If no headers are extracted from the input, then the configured headers in CommonSettings#getHeaders() will be returned.

Returns:String[]

the headers associated with the Records parsed from the input

indexOfback to summary
public int indexOf(Enum<?> column)

Returns the index of a given column

Parameters
column:Enum<?>

the column whose index will be returned

Returns:int

index of the given column

indexOfback to summary
public int indexOf(String headerName)

Returns the index of a given column

Parameters
headerName:String

name of the column whose index will be returned

Returns:int

index of the given column

selectedHeadersback to summary
public String[] selectedHeaders()

Returns the sequence of headers that have been selected. If no selection has been made, all available headers will be returned, producing the same output as a call to method headers().

Returns:String[]

the sequence of selected headers, or all headers if no selection has been made.

setDefaultValueOfColumnsback to summary
public <T> void setDefaultValueOfColumns(T defaultValue, Enum<?>... columns)

Associates a default value with one or more columns, in case the values contained are null

Parameters
<T>
type of the default value.
defaultValue:T

the value to be used for the given column when the parsed result is null

columns:Enum<?>[]

the columns to be associated with a default value.

setDefaultValueOfColumnsback to summary
public <T> void setDefaultValueOfColumns(T defaultValue, String... headerNames)

Associates a default value with one or more columns, in case the values contained are null

Parameters
<T>
type of the default value.
defaultValue:T

the value to be used for the given column when the parsed result is null

headerNames:String[]

the column names to be associated with a default value.

setDefaultValueOfColumnsback to summary
public <T> void setDefaultValueOfColumns(T defaultValue, int... columnIndexes)

Associates a default value with one or more columns, in case the values contained are null

Parameters
<T>
type of the default value.
defaultValue:T

the value to be used for the given column when the parsed result is null

columnIndexes:int[]

the column indexes to be associated with a default value.

setTypeOfColumnsback to summary
public void setTypeOfColumns(Class<?> type, Enum<E extends Enum<E>>... columns)

Associates a type with one or more column. This allows the parsed data to be converted automatically to the given type when reading data from a Record, e.g. Record#toFieldObjectMap(String...) will convert the selected field values to their respective types, and then set the result as the values in the map.

Parameters
type:Class<?>

the type to associate with a list of column

columns:Enum<E extends Enum<E>>[]

the columns that will be associated with the given type.

Annotations
@SuppressWarnings:rawtypes
setTypeOfColumnsback to summary
public void setTypeOfColumns(Class<?> type, String... headerNames)

Associates a type with one or more column. This allows the parsed data to be converted automatically to the given type when reading data from a Record, e.g. Record#toFieldObjectMap(String...) will convert the selected field values to their respective types, and then set the result as the values in the map.

Parameters
type:Class<?>

the type to associate with a list of column

headerNames:String[]

the columns that will be associated with the given type.

setTypeOfColumnsback to summary
public void setTypeOfColumns(Class<?> type, int... columnIndexes)

Associates a type with one or more column. This allows the parsed data to be converted automatically to the given type when reading data from a Record, e.g. Record#toFieldObjectMap(String...) will convert the selected field values to their respective types, and then set the result as the values in the map.

Parameters
type:Class<?>

the type to associate with a list of column

columnIndexes:int[]

the columns that will be associated with the given type.

typeOfback to summary
public Class<?> typeOf(Enum<?> column)

Returns the type associated with a given column, defined with the method setTypeOfColumns(type, columns)

Parameters
column:Enum<?>

the column whose type will be returned

Returns:Class<?>

the type of the given column

typeOfback to summary
public Class<?> typeOf(String headerName)

Returns the type associated with a given column name, defined with the method setTypeOfColumns(type, columns)

Parameters
headerName:String

name of the column whose type will be returned

Returns:Class<?>

the type of the given column

typeOfback to summary
public Class<?> typeOf(int columnIndex)

Returns the type associated with a given column, defined with the method setTypeOfColumns(type, columns)

Parameters
columnIndex:int

the position of the column whose type will be returned

Returns:Class<?>

the type of the given column