Class ConvertWordNullToNull

  • All Implemented Interfaces:
    StringProcessor

    public class ConvertWordNullToNull
    extends java.lang.Object
    implements 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.
    Since:
    5.4
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String processString​(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.
      void setParameterString​(java.lang.String value)
      This method is unused in this implementation as we are converting to null.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConvertWordNullToNull

        public ConvertWordNullToNull()
        Default Constructor.
    • Method Detail

      • processString

        public java.lang.String processString​(java.lang.String value)
        Description copied from interface: StringProcessor
        Method that contains the code that will transform a string into the value that will be validated and converted into the bean field.
        Specified by:
        processString in interface StringProcessor
        Parameters:
        value - String to 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:
        setParameterString in interface StringProcessor
        Parameters:
        value - Information used by the processor to process the string