Package com.opencsv.bean.processor
Class ConvertEmptyOrBlankStringsToNull
- java.lang.Object
-
- com.opencsv.bean.processor.ConvertEmptyOrBlankStringsToNull
-
- All Implemented Interfaces:
StringProcessor
public class ConvertEmptyOrBlankStringsToNull extends java.lang.Object implements StringProcessor
StringProcessor that converts the empty or blank strings to a literal null string. This is useful when you prefer null in a particular variable.A sample of this can be found in the unit test ProcessorTestBean and is annotated as follows.
@PreAssignmentProcessor(processor = ConvertEmptyOrBlankStringsToNull.class) @CsvBindByName(column = "name") private String beanName;- Since:
- 5.4
-
-
Constructor Summary
Constructors Constructor Description ConvertEmptyOrBlankStringsToNull()Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringprocessString(java.lang.String value)Method that contains the code that will transform a string into the value that will be validated and converted into the bean field.voidsetParameterString(java.lang.String value)This method is unused in this implementation as we are converting to null.
-
-
-
Method Detail
-
processString
public java.lang.String processString(java.lang.String value)
Description copied from interface:StringProcessorMethod that contains the code that will transform a string into the value that will be validated and converted into the bean field.- Specified by:
processStringin interfaceStringProcessor- Parameters:
value-Stringto be processed- Returns:
- The processed
String
-
setParameterString
public void setParameterString(java.lang.String value)
This method is unused in this implementation as we are converting to null. Any calls to this method are ignored.- Specified by:
setParameterStringin interfaceStringProcessor- Parameters:
value- Information used by the processor to process the string
-
-