polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Merlin <p...@nosphere.org>
Subject Re: toValue() and toEntity()
Date Fri, 15 May 2015 17:48:31 GMT
Niclas Hedhman a écrit :
> Rickard added the support for handling Associations in Values, and we also
> now have the full support of sharing super-types between Entities and
> Values.
>
> So, it would make sense that if I declare the assembly;
>
>     module.entities( Person.class );
>     module.values( Person.class );
>
> that I could do;
>
>     Person entity = ...;
>     Person value = api.toValue( Person,class, entity );
>
> as well as the other way around;
>
>     Person value = ...;
>     Person entity = api.toEntity( Person.class, entity );
>
> The implementation of this is fairly small and straight forward, and I have
> most of it in place in my project already, but I think it really belongs in
> the API itself, as this would be super-neat for Rest APIs and other work
> outside of UnitOfWorks.
>
> WDYT?
Is this close to what the `conversion` library does?
I added Value -> Entity conversion in there lately (develop branch, QI-414).

Cheers


Mime
View raw message