Thanks, David B. =David
> On Aug 15, 2016, at 6:01 PM, David Bosschaert <[email protected]> > wrote: > > Hi David, > > Yes, > MyDTO copy = cnv.convert( dto ).to( MyDTO.class ); > will create a copy. Whenever a conversion is done to a key-value based type > (map, dictionary, interface, annotation, JavaBean or DTO) the converter > will create a copy which can be owned and possibly further modified by the > caller. > > I will certainly bring the idea of adding an explicit copy() method to the > Converter design discussions at OSGi. > > Cheers and thanks for the feedback! > > David > > > On 15 August 2016 at 08:25, David Leangen <[email protected]> wrote: > >> >> Hi! >> >> To put my question into context: on the bndtools list, I asked this >> question, and got this response Peter K.: >> >>>> Is there a simple way to transform a DTO into an immutable value object? >>> Not in enRoute and not in the new spec that was inspired by this >> service. In general you pass copies so they can do whatever they like with >> them. >> >> Fine. But I am not seeing a simple way of creating such copy. Is there a >> “clone” method of some sort, or do I just convert an object to another >> object of its own type? Like this: >> >> MyDTO copy = cnv.convert( dto ).to( MyDTO.class ); >> >> If making copies is indeed how this service is intended to be used, it >> would be nice to have a more explicit method for this, maybe: >> >> MyDTO copy = cnv.copy( dto ); >> >> Or even this: >> >> MyDTO copy = cnv.clone( dto ); >> >> >> wdyt? >> >> >> Cheers, >> =David >> >> >>
