Open GoogleCodeExporter opened 8 years ago
Sorry for the late reply, I will take a look at ASAP.
Thanks for the report and test case :)
Original comment by elaat...@gmail.com
on 23 Jan 2013 at 10:40
This is standard behavior (at least currently)...converters don't get called
for nulls.
We could potentially add this as enhancement, but it could be pretty
disruptive...maybe it should be an option that can be set at
global/classmap/fieldmap levels?
Original comment by matt.deb...@gmail.com
on 30 Jan 2013 at 7:13
Hello everyone,
I run into this too. I admit it's not very typical situation, but sometimes it
would be handy.
Maybe Converters could have convertsNull() method returning boolean, which
could signal if it is desired behaviour for given converter.
Would be definitelly nice to have.
Original comment by tomas.ho...@gmail.com
on 7 Feb 2013 at 12:14
Original comment by elaat...@gmail.com
on 8 Feb 2013 at 12:46
[deleted comment]
I'd like to see this option as well. I have several cases of needing this.
What about a new method on FieldMapBuilder I could call upon each field map to
tell it whether or not to use the converter in the case of nulls? Default
would be false (it does not apply for nulls), since that's the current
behavior. For example:
dtoMapperFactory.getMapperFactory()
.classMap(ObjA.class, ObjB.class)
.fieldMap("state", "status")
.converter("myConverterId")
.useConverterForNulls(true)
.add()
.register();
Original comment by matthew....@gmail.com
on 27 Aug 2013 at 3:53
Is there already a patch to this bug? We need this very much. Thanks
Original comment by w.yu...@gmail.com
on 9 Oct 2013 at 1:26
We also need this, but I'm not sure what would be the best way.
A flag in the Converter that controls whether null mappings are supported makes
sense. By default it returns false so all existing Converters will work as
expected. If we combine that with mapNulls(InReverse) then it should cover all
use cases I can think of.
Original comment by l.brueni...@googlemail.com
on 15 Nov 2013 at 10:11
Is there any update on this issue? Is somebody actively working on it? Do you
guys need collaboration to make it happen? Just let me know, I can take a look.
Regards.
Original comment by nicolasa...@gmail.com
on 4 Nov 2014 at 11:24
I am hitting this issue. The current behavior of one of the field in my case is
to do Strings.NullToEmpty(). Thus, I wrote a converter for that.
The converter is not getting called! :-(
Original comment by mpoitras...@gmail.com
on 24 Dec 2014 at 6:57
I also run into this issue. Want to convert a null value to a default value
which is a pretty normal use case I think.
Original comment by c.moetz...@gmail.com
on 19 Jan 2015 at 3:59
hi,
this is a long running thread - was this issue resolved in any version post
1.4.4 ?
Original comment by tomer.pi...@gmail.com
on 5 Jul 2015 at 3:04
This is an api breaking change request, right now all converters do not verify
if the source value is null or not and assume it's not null.
Original comment by elaat...@gmail.com
on 6 Jul 2015 at 12:10
Original issue reported on code.google.com by
benjamin...@gmail.com
on 22 Jan 2013 at 12:27Attachments: