Class InputValueSwitch
java.lang.Object
com.univocity.parsers.common.processor.core.AbstractProcessorSwitch<ParsingContext>
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 of
RowProcessorSwitch that allows switching among different implementations of
RowProcessor based on values found on the rows parsed from the input.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a switch that will analyze the first column of rows found in the input to determine whichRowProcessorto use for each parsed rowInputValueSwitch(int columnIndex) Creates a switch that will analyze a column of rows parsed from the input to determine whichRowProcessorto use.InputValueSwitch(String columnName) Creates a switch that will analyze a column in rows parsed from the input to determine whichRowProcessorto use. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ParsingContextwrapContext(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 AbstractInputValueSwitch
addSwitchForValue, addSwitchForValue, addSwitchForValue, addSwitchForValue, addSwitchForValue, addSwitchForValue, getHeaders, getIndexes, hasDefaultSwitch, setCaseSensitive, setComparator, setDefaultSwitch, setDefaultSwitch, setDefaultSwitch, switchRowProcessorMethods inherited from class AbstractProcessorSwitch
preventColumnReordering, processEnded, processorSwitched, processStarted, rowProcessed, rowProcessorSwitchedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RowProcessor
processEnded, processStarted, rowProcessed
-
Constructor Details
-
InputValueSwitch
public InputValueSwitch()Creates a switch that will analyze the first column of rows found in the input to determine whichRowProcessorto 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 whichRowProcessorto use.- Parameters:
columnIndex- the column index whose value will be used to determine whichRowProcessorto use for each parsed row.
-
InputValueSwitch
Creates a switch that will analyze a column in rows parsed from the input to determine whichRowProcessorto use.- Parameters:
columnName- name of the column whose values will be used to determine whichRowProcessorto use for each parsed row.
-
-
Method Details
-
wrapContext
Description copied from class:AbstractProcessorSwitchWraps a given parser context object that returns headers and extracted field indexes associated with a given processor in this switch.- Specified by:
wrapContextin 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()
-