private Object extractValue ( String line , int lineNumber , ColumnInfo < Object > columnInfo , String columnStr , int linePos , Object target , ParseError parseError ) { Converter < Object , ? > converter = columnInfo . getConverter ( ) ; if ( alwaysTrimInput || columnInfo . isTrimInput ( ) || converter . isAlwaysTrimInput ( ) ) { columnStr = columnStr . trim ( ) ; } if ( columnStr . isEmpty ( ) && columnInfo . getDefaultValue ( ) != null ) { columnStr = columnInfo . getDefaultValue ( ) ; } if ( columnStr . isEmpty ( ) && columnInfo . isMustNotBeBlank ( ) ) { parseError . setErrorType ( ErrorType . MUST_NOT_BE_BLANK ) ; parseError . setMessage ( "field '" + columnInfo . getFieldName ( ) + "' must not be blank" ) ; assignParseErrorFields ( parseError , columnInfo , columnStr ) ; parseError . setLinePos ( linePos ) ; return null ; } try { return converter . stringToJava ( line , lineNumber , linePos , columnInfo , columnStr , parseError ) ; } catch ( ParseException e ) { parseError . setErrorType ( ErrorType . INVALID_FORMAT ) ; parseError . setMessage ( "field '" + columnInfo . getFieldName ( ) + "' parse-error: " + e . getMessage ( ) ) ; parseError . setLinePos ( linePos ) ; return null ; } catch ( Exception e ) { parseError . setErrorType ( ErrorType . INTERNAL_ERROR ) ; parseError . setMessage ( "field '" + columnInfo . getFieldName ( ) + "' error: " + e . getMessage ( ) ) ; parseError . setLinePos ( linePos ) ; return null ; } }
Extract a value from the line and convert it into its java equivalent .