Announcement Announcement Module
Collapse
No announcement yet.
Why make FieldSet final? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why make FieldSet final?

    I am not sure why Spring Batch team make FieldSet final. This decision limits customized formatting. For example, some of my client send Date field as CCYYMMDD. When they do not have a valid date, they put "00000000" and readDate will generate bad results (no exception). I would like to overwrite readDate to handle it correctly.

    Also, our client is encoding numbers as IBM numeric so the last digits is symbols like "{", "A", etc. I would like to overwrite readDecimal to handle it correctly.

    From design perspective, why not allowing extending FieldSet?

    Thanks

  • #2
    I think we can probably allow extensions to FieldSet. It's a tough call when writing frameworks, how much to expose for extension, and traditionally Spring has been rather lax. In this case I can see that it is a pretty useful extension point, and the package is definitely not internal, since it necessarily contains the FieldSetMapper interface. I will change FieldSet to be non-final.

    Comment


    • #3
      Dave,

      Can you also perhaps make FieldSet be an interface rather than a class (and make the current FieldSet be "FieldSetImpl")? Since your docs say this:
      A FieldSet is conceptually very similar to a Jdbc Result Set.
      this would be more consistent with the ResultSet and [font=courier]RowSet[/courier] which are both interfaces.

      There are some other suggestions I have regarding the FieldSet which I hope to post in the next day or so, but I'm finishing up some sample code I'll share with you before I do so.

      Comment


      • #4
        Dave,

        Thanks for the quick response.

        It would be great if you can change indexOf to protected too. It is very useful when trying to extend this class.

        I would agree with Tony it makes sense to make it an interface.
        Last edited by joeserel; Jan 14th, 2008, 04:13 PM.

        Comment


        • #5
          I've opened a JIRA for the FieldSet interface...
          http://jira.springframework.org/browse/BATCH-289

          Comment

          Working...
          X