Needs to dynamically include or exclude some fields during mapping.

883 views
Skip to first unread message

sanj...@gmail.com

unread,
May 3, 2013, 5:28:06 AM5/3/13
to dozer-...@googlegroups.com

Hi,
    I have one requirement where in I need to dynamically map certain fields based on null or not null.  Currently dozer supports it with no control on it.  In other words, I can exclude it by specfying exclude-fields tag.  However my requirement is that i need to exclude it only if it is null.  Is there is any way this can be fine tuned. 

Note:-  By using map-null="true" or map-null="false" at class level or mapping level will not help.  Since by using this either i am placing null or ignoring the fields.  But in database it will update as null in case it dosn't have value.  So i want to ignore it some how.  Can any one suggest some technique or any way this can be worked out.

Regards
Sanjeev.Y.B

Thibault Cuvillier

unread,
Jun 3, 2013, 11:33:41 AM6/3/13
to dozer-...@googlegroups.com
HI,

I have the same requirement. My beans attributes have a flag loaded set to true if the value if defined.
I use it to return partially initialized beans.

For the mapping, I'd like to filter out dynamycally the not-loaded fields .
What I'd need is an interface used to filter the fields to be mapped, and to provide the implementation for all the beans, or for a specific bean in the Dozer config.

Any solution ?

Tibo
Reply all
Reply to author
Forward
0 new messages