Announcement Announcement Module
Collapse
No announcement yet.
Register custom property editor based on property name rather than type? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Register custom property editor based on property name rather than type?

    Hi! I'm writing a batch that parses a file and maps it to a POJO. My POJO has several properties of the type Integer, which need different mapping strategies. Some of the Integers represent ID fields, while other represent amounts of money.

    The file has a very different representation of the two kinds of fields (ID and money), so I need different mapping. I was planning to use the BeanWrapperFieldSetMapper, and custom editors, but now I realize I can only register one editor for mapping to Integers. Do I have to write my own FieldSetMapper, or are there other solutions for doing custom mapping?

  • #2
    For these field-specific use cases you are supposed to extend BeanWrapperFieldSetMapper and override registerCustomEditors(). You can also do it in initBinder() (ignore what it says in the Javadocs) if you prefer.
    Last edited by Dave Syer; Sep 28th, 2009, 09:25 AM. Reason: Spelling

    Comment

    Working...
    X