public class HeaderIndex extends Object
BidiMap
will not do the
trick, because header names (or null in place of a header name) may appear
more than once.Constructor and Description |
---|
HeaderIndex()
Useless but explicit nullary constructor to make the style checker happy.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Empties the entire mapping.
|
int |
findMaxIndex()
Finds and returns the highest index in this mapping.
|
int[] |
getByName(String headerName)
Retrieves the column position(s) associated with the given header name.
|
String |
getByPosition(int i)
Retrieves the header associated with the given column position.
|
String[] |
getHeaderIndex() |
int |
getHeaderIndexLength() |
void |
initializeHeaderIndex(String[] header)
Initializes the index with a list of header names in proper encounter
order.
|
boolean |
isEmpty() |
void |
put(int k,
String v)
Adds a new mapping between a column position and a header.
|
public HeaderIndex()
public void clear()
public int findMaxIndex()
public void initializeHeaderIndex(String[] header)
CsvBindAndJoinByPosition
or
CsvBindAndJoinByName
. Values of null
indicate the column
from the input should not be mapped to a bean field.header
- A list of header names in the order in which they are
expected in the CSV inputpublic boolean isEmpty()
public int[] getByName(String headerName)
headerName
- The header name for which the associated column
positions should be returnedheaderName
public String getByPosition(int i)
i
- The column position for which the header name is to be retrievedi
public String[] getHeaderIndex()
public int getHeaderIndexLength()
public void put(int k, String v)
k
- The column position for the mappingv
- The header to be associated with the column positionCopyright © 2005–2023. All rights reserved.