From: Matt B. <gud...@ya...> - 2007-04-16 22:16:48
|
A simplified use case: I have an object hierarchy of which certain classes represent collections (but are not "Collection"s). I may build an object graph that needs to have another graph copied to it. Parts of the source graph may be null, but for my purposes I need a copier that knows how to copy null on the source graph to the collection type on the destination graph by making it empty. It was a one-line change to BaseTransformer.copy() to allow me to do this. If you are not "married to" the idea that null is NEVER a valid copy source, can we let this change stand? As far as I can see this is the only way to completely correctly satisfy this particular use case, so this indicates to me that occasionally there may be a reason to allow this. -Matt B --- Matt Sgarlata <Mat...@wh...> wrote: > The idea behind a convert operation is you are > transforming one object > into another object. I think it can make sense to > transform null to > "null" (a String containing 4 characters) or > something else, so a source > of null on a convert operation makes sense. > > The idea behind a copy operation is you are taking > information from one > object and copying that information to some other > object. A null by > definition is nothing, so to me it doesn't make > sense that you're > copying nothing onto something. I can't actually > write down nothing, > it's the same as having not written anything at all. > > I'm not married to the idea that null sources are > allowed for > conversions but not for copy operations, but I can't > think of an example > where copying a null onto some other object would > actually make sense. > I would expect this to be a programmer error, and so > that is why a > TransformationException is thrown. > > Matt S > > Matt Benson wrote: > > Currently the Copier interface carries the > implicit > > message that the source object cannot be null. > Should > > we persist in this assumption, or do we believe > it's > > possible sometimes that null can be a legitimate > copy > > source? > > > > -Matt B > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 > express and take > > control of your XML. No limits. Just data. Click > to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > morph-developer mailing list > > mor...@li... > > > https://lists.sourceforge.net/lists/listinfo/morph-developer > > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 > express and take > control of your XML. No limits. Just data. Click to > get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > morph-developer mailing list > mor...@li... > https://lists.sourceforge.net/lists/listinfo/morph-developer > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |