-
Sep 28th, 2009, 07:35 AM
#1
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?
-
Sep 28th, 2009, 08:24 AM
#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 at 08:25 AM.
Reason: Spelling
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules