Menu

#69 Patch to support modifying the default value of ResultSetHelperService

Unstable (example)
open
nobody
None
5
2024-02-26
2024-02-24
Jon Schewe
No

I have a use case where I would like to change the default value in ResultSetHelperService from the empty string to something that makes it clear a null was read. Would you be open to a patch that either makes this settable or makes it possible to subclass and modify the default value without duplicating most of the class?

If so, which would you prefer?

Discussion

  • Jon Schewe

    Jon Schewe - 2024-02-25

    I did some more work on this and realized that the solution I need is likely more specialized than would make sense to add to the library. I believe I can handle this by writing a custom ResultSetHelper class.

     
  • Scott Conway

    Scott Conway - 2024-02-25

    Sorry I missed your original post. But for the original question - it depends. If it is a single change that if left unset or by default leaves the original functionality unchanged (so by default it does not change established behavior) then I am okay with a simple setter. If it is a very pervasive change that is difficult not to modify existing behavior then extension would be the route to go - which you can see in the ResultSetColumnNameHelperService.

    Let me know if you need/want to change the scope of any of the methods in the ResultSetHelperService.

    Scott :)

     
  • Jon Schewe

    Jon Schewe - 2024-02-26

    My specific case is that I want to represent NULL with an explicit string value. If a non-null value evaluates to the NULL string value, then prepend the NULL string value. Then when loading the CSV file back if the value read is the NULL string value then insert a NULL into the database. If the value read starts with NULL string value, then remove it and insert into the database. So it's both an export and import. At this point opencsv doesn't do it's own import, so I suspect this isn't something that belongs in the library.

     

Log in to post a comment.