Top Description Constructors Methods
com.opencsv.bean.processor

public Class ConvertWordNullToNull

extends Object
implements StringProcessor
Class Inheritance
All Implemented Interfaces
com.opencsv.bean.processor.StringProcessor

StringProcessor that converts the string value "null" to a literal null string. This is useful when you are dealing with csv files that actually use the word null.

A sample of this can be found in the Integration tests FR138MockBean and is annotated as follows.

    @PreAssignmentProcessor(processor = ConvertWordNullToNull.class)
    private int num;
Without the annotation an CSVMalformedException is thrown when trying to conver the string "null" to an int. But with it is considered a null String and the int gets a default value of 0.
Author
Scott Conway
Since
5.4

Constructor Summary

AccessConstructor and Description
public
ConvertWordNullToNull()

Default Constructor.

Method Summary

Modifier and TypeMethod and Description
public String
processString(String value)

Implements com.opencsv.bean.processor.StringProcessor.processString.

Method that contains the code that will transform a string into the value that will be validated and converted into the bean field.

public void
setParameterString(String
Information used by the processor to process the string
value
)

Implements com.opencsv.bean.processor.StringProcessor.setParameterString.

This method is unused in this implementation as we are converting to null.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConvertWordNullToNullback to summary
public ConvertWordNullToNull()

Default Constructor.

Method Detail

processStringback to summary
public String processString(String value)

Implements com.opencsv.bean.processor.StringProcessor.processString.

Doc from com.opencsv.bean.processor.StringProcessor.processString.

Method that contains the code that will transform a string into the value that will be validated and converted into the bean field.

Annotations
@Override
setParameterStringback to summary
public void setParameterString(String value)

Implements com.opencsv.bean.processor.StringProcessor.setParameterString.

This method is unused in this implementation as we are converting to null. Any calls to this method are ignored.

Parameters
value:String

Information used by the processor to process the string

Annotations
@Override