Class InputValueSwitch
- java.lang.Object
-
- com.univocity.parsers.common.processor.core.AbstractProcessorSwitch<T>
-
- com.univocity.parsers.common.processor.core.AbstractInputValueSwitch<ParsingContext>
-
- com.univocity.parsers.common.processor.InputValueSwitch
-
- All Implemented Interfaces:
ColumnOrderDependent
,Processor<ParsingContext>
,RowProcessor
public class InputValueSwitch extends AbstractInputValueSwitch<ParsingContext> implements RowProcessor
A concrete implementation ofRowProcessorSwitch
that allows switching among different implementations ofRowProcessor
based on values found on the rows parsed from the input.
-
-
Constructor Summary
Constructors Constructor Description InputValueSwitch()
Creates a switch that will analyze the first column of rows found in the input to determine whichRowProcessor
to use for each parsed rowInputValueSwitch(int columnIndex)
Creates a switch that will analyze a column of rows parsed from the input to determine whichRowProcessor
to use.InputValueSwitch(java.lang.String columnName)
Creates a switch that will analyze a column in rows parsed from the input to determine whichRowProcessor
to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ParsingContext
wrapContext(ParsingContext context)
Wraps a given parser context object that returns headers and extracted field indexes associated with a given processor in this switch.-
Methods inherited from class com.univocity.parsers.common.processor.core.AbstractInputValueSwitch
addSwitchForValue, addSwitchForValue, addSwitchForValue, addSwitchForValue, addSwitchForValue, addSwitchForValue, getHeaders, getIndexes, hasDefaultSwitch, setCaseSensitive, setComparator, setDefaultSwitch, setDefaultSwitch, setDefaultSwitch, switchRowProcessor
-
Methods inherited from class com.univocity.parsers.common.processor.core.AbstractProcessorSwitch
preventColumnReordering, processEnded, processorSwitched, processStarted, rowProcessed, rowProcessorSwitched
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.univocity.parsers.common.processor.RowProcessor
processEnded, processStarted, rowProcessed
-
-
-
-
Constructor Detail
-
InputValueSwitch
public InputValueSwitch()
Creates a switch that will analyze the first column of rows found in the input to determine whichRowProcessor
to use for each parsed row
-
InputValueSwitch
public InputValueSwitch(int columnIndex)
Creates a switch that will analyze a column of rows parsed from the input to determine whichRowProcessor
to use.- Parameters:
columnIndex
- the column index whose value will be used to determine whichRowProcessor
to use for each parsed row.
-
InputValueSwitch
public InputValueSwitch(java.lang.String columnName)
Creates a switch that will analyze a column in rows parsed from the input to determine whichRowProcessor
to use.- Parameters:
columnName
- name of the column whose values will be used to determine whichRowProcessor
to use for each parsed row.
-
-
Method Detail
-
wrapContext
protected final ParsingContext wrapContext(ParsingContext context)
Description copied from class:AbstractProcessorSwitch
Wraps a given parser context object that returns headers and extracted field indexes associated with a given processor in this switch.- Specified by:
wrapContext
in classAbstractProcessorSwitch<ParsingContext>
- Parameters:
context
- the context to wrap- Returns:
- a wrapped context that returns the headers and extracted field
indexes from
AbstractProcessorSwitch.getHeaders()
andAbstractProcessorSwitch.getIndexes()
-
-