From: Matt S. <Mat...@wh...> - 2008-01-04 13:16:33
|
Yikes, that doesn't sound good. I'm wondering if it would be possible to fix this as an implementation concern rather than introducing a new interface. Perhaps the ordering of the source and destination classes could be used by the ChainedTransformer to give an indication of preference for the conversion path chosen. Can you give me a concrete example where data is lost? I would be very interested in setting up a test case that demonstrates the problem and also a solution for the problem. This is the type of problem with Morph that I have a lot of fun with ;) Matt S On Jan 3, 2008 5:27 PM, Matt Benson <gud...@ya...> wrote: > In using ChainedTransformer I find I have to jump > through hoops at times to pick the proper > transformation path, particularly with the > TextConverter. If it happens to pick char, Character, > or null as a conversion step between e.g. a "to-text" > converter and a "from-text" converter, data is lost. > I am thinking of an interface like this: > > public interface ImpreciseConverter extends Converter > { > boolean isImpreciseConversion(Class > destinationClass, Class sourceClass); > } > > The default implementation on BaseTransformer: > > public boolean isImpreciseConversion(Class > destinationClass, Class sourceClass) { > return destinationClass == null && sourceClass != > null; > } > > TextConverter would report that a conversion from a > string to null or char is imprecise. > ChainedTransformer could then be coded to avoid > imprecise conversions when possible. > > WDYT? > > -Matt B > > > > > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > morph-developer mailing list > mor...@li... > https://lists.sourceforge.net/lists/listinfo/morph-developer > -- This message is intended only for the named recipient. If you are not the intended recipient, you are notified that disclosing, copying, distributing, or taking any action in reliance on the contents of this information is strictly prohibited. |