atos1990 / orika

Automatically exported from code.google.com/p/orika
0 stars 0 forks source link

Capability to map from object to hashmap/list/array #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In some cases (Spring JdbcTemplate for one) it may be necessary to send all of 
an object's properties as a HashMap, keyed by property

factory.classMap(BlahBean.class, HashMap.class) {
    .field("name.first", "fistName")
    .field("address.postalCode", "zipCode")
    .byDefault()...

which would map value of BlahBean.name.first under the key 'firstName', and so 
on.

Similarly, mapping to arrays/collections should be considered:
factory.classMap(BlahBean.class, ArrayList.class) {
    .field("name.first", "[0]")
    .field("address.postalCode", "[1]")
    .byDefault()... // a little tricky here: continue mapping all   
                    // properties (in declared order? in alphabetic order?)

Original issue reported on code.google.com by matt.deb...@gmail.com on 27 Sep 2012 at 9:14

GoogleCodeExporter commented 9 years ago
implemented in 1.3.0 release

Original comment by matt.deb...@gmail.com on 5 Oct 2012 at 4:17