Top Description Fields Constructors Methods
com.univocity.parsers.common

public abstract Class RetryableErrorHandler<T extends Context>

extends Object
implements ProcessorErrorHandler<T extends Context>
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.common.ProcessorErrorHandler

A ProcessorErrorHandler implementation that gives the user a chance to provide a default value for columns that could not be processed due to an exception, through the method setDefaultValue(Object). This must be called from within the implementation of the handleError(DataProcessingException, Object[], Context) method, and will prevent the record from being discarded. The value provided by the user will be assigned to the problematic input row, at the column defined by DataProcessingException#getColumnIndex()

Note

If the column index is < 0, then the record can't be salvaged and it will be discarded regardless of the user calling setDefaultValue(Object) or not.

Author
Univocity Software Pty Ltd - [email protected]
See Also
DataProcessingException, TextParsingException, AbstractParser, AbstractWriter, CommonSettings, Context

Field Summary

Modifier and TypeField and Description
private Object
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final Object

Returns:

the value to be used for the current column. It will be discarded after handling the current DataProcessingException.
getDefaultValue
()

Returns the default value to be assigned to the problematic column that raised the current DataProcessingException.

public final boolean

Returns:

true if the record originating the current DataProcessingException should be skipped, otherwise false
isRecordSkipped
()

Flag indicating whether the current record will be skipped.

public final void
keepRecord()

Ignores the DataProcessingException and instructs the parser/writer to continue processing the record.

pack-priv final void
prepareToRun()

Prepares this error handler to be executed.

public final void
setDefaultValue(Object
the value to be used for the current column. It will be discarded after handling the current DataProcessingException.
defaultValue
)

Assigns a default value to be assigned to the problematic column that raised the current DataProcessingException.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultValueback to summary
private Object defaultValue
skipRecordback to summary
private boolean skipRecord

Constructor Detail

RetryableErrorHandlerback to summary
public RetryableErrorHandler()

Method Detail

getDefaultValueback to summary
public final Object getDefaultValue()

Returns the default value to be assigned to the problematic column that raised the current DataProcessingException. The current column is available from the exception itself, i.e. DataProcessingException#getColumnIndex()

Note

If the column index is < 0, then the record can't be salvaged and it will be discarded regardless of the user calling setDefaultValue(Object) or not.

Returns:Object

the value to be used for the current column. It will be discarded after handling the current DataProcessingException.

isRecordSkippedback to summary
public final boolean isRecordSkipped()

Flag indicating whether the current record will be skipped. Returns true by default unless the user invokes setDefaultValue(Object) from within the handleError(DataProcessingException, Object[], Context) method implementation, in which case the current record will continue to be processed.

Returns:boolean

true if the record originating the current DataProcessingException should be skipped, otherwise false

keepRecordback to summary
public final void keepRecord()

Ignores the DataProcessingException and instructs the parser/writer to continue processing the record.

prepareToRunback to summary
pack-priv final void prepareToRun()

Prepares this error handler to be executed. This is called automatically by the library prior to invoking method handleError(DataProcessingException, Object[], Context)

setDefaultValueback to summary
public final void setDefaultValue(Object defaultValue)

Assigns a default value to be assigned to the problematic column that raised the current DataProcessingException. The current column is available from the exception itself, i.e. DataProcessingException#getColumnIndex()

Note

If the column index is < 0, then the record can't be salvaged and it will be discarded regardless of the user calling setDefaultValue(Object) or not.

Parameters
defaultValue:Object

the value to be used for the current column. It will be discarded after handling the current DataProcessingException.