Open GoogleCodeExporter opened 9 years ago
Of course we can add it as extention but I'd prefer not imposing some style,
with open Java API you can organize your mapping code as you like (XML, Groovy
DSL, or even annotation).
Look at this example, it's based on Spring "context:scan"
http://code.google.com/p/orika/source/browse/branches/examples/src/main/java/ma/
glasnost/orika/examples/common/
MapperFacadeFactoryBean look for all classes implementing a MappingConfigurer
interface and run them against the MapperFactory.
You can have as many as MappingConfigurer, you can make one per module, per
service ... any convention that feet your needs,
We used it to build more than 700 ClassMap instances!.
I'll kept this issue Open, for discussion. Thanks!
Original comment by elaat...@gmail.com
on 10 Sep 2012 at 5:45
Hi
the attached file I uploaded was a wrapper project base on orika 1.1.5. The
main concept is to read my own xml definition from the xml files.
And here I attach the mapping xml example also
And spring bean definition example can be like this
<bean id = "orikaMapper" class = "com.best.beanmapping.orika.OrikaBeanMapper"
init-method ="init">
<property name="mappingFiles">
<list>
<value>orika-bean-mappings.xml</value>
<value>orika-bean-mappings-base.xml</value>
<value>orika-bean-mappings-salesOrder.xml</value>
<value>orika-bean-mappings-box.xml</value>
<value>orika-bean-mappings-system.xml</value>
<value>orika-bean-mappings-rule.xml</value>
<value>orika-bean-mappings-log.xml</value>
<value>orika-bean-mappings-inventory.xml</value>
<value>orika-bean-mappings-asn.xml</value>
<value>orika-bean-mappings-myInv.xml</value>
<value>orika-bean-mappings-fee.xml</value>
<value>orika-bean-mappings-import.xml</value>
<value>orika-bean-mappings-task.xml</value>
<value>orika-bean-mappings-crossDocking.xml</value>
<value>orika-bean-mappings-rma.xml</value>
<value>orika-bean-mappings-wo.xml</value>
<value>orika-bean-mappings-inventorycheck.xml</value>
<value>orika-bean-mappings-distribution.xml</value>
<value>orika-bean-mappings-lpn.xml</value>
<value>orika-bean-mappings-invOperation.xml</value>
</list>
</property>
<property name="customConverters">
<list>
<ref bean="genidcUserNameConverter" />
<ref bean="genidcDomainCodeConverter" />
</list>
</property>
<property name="generalCustomConverters">
<list>
<ref bean="genidcDcEntityConverter" />
<ref bean="genidcCdEntityConverter" />
</list>
</property>
<property name="proxyHandler">
<ref bean = "hibernateProxyBeanHandler" />
</property>
</bean>
<bean id = "hibernateProxyBeanHandler" class= "com.best.oasis.genidc.biz.component.orika.HibernateProxyBeanHandler"/>
<bean id = "dozerBeanUtil" class = "com.best.oasis.genidc.biz.component.DozerBeanUtil" >
<property name="beanMapper">
<ref bean = "orikaMapper"/>
</property>
</bean>
Hope this can help you.
But... after reviewing the new features in orika1.2.0, I think this can be
designed more elgegant.
Original comment by wangbt5...@gmail.com
on 20 Sep 2012 at 9:33
Attachments:
And I hope this can go into orika base code. You know when dealing with the
legacy projects, we do not want to add annotation every well. And also the xml
mapping can be easily organized.
Original comment by wangbt5...@gmail.com
on 20 Sep 2012 at 9:37
I'm with you that annotations on the mapped classes are not a good solution
when dealing with either different ways to map classes or with legacy or
generated code that you cannot modify.
Original comment by reydelam...@gmail.com
on 20 Sep 2012 at 9:55
Original comment by wangbt5...@gmail.com
on 21 Sep 2012 at 2:21
Attachments:
Sorry, attached wrong mapping xml, upload again.
Original comment by wangbt5...@gmail.com
on 21 Sep 2012 at 2:21
See https://github.com/ikozar/orika/tree/xml-configurer ,
branch xml-configurer, module configurator.
It support some features been mapping in Dozer style.
Original comment by ki2...@gmail.com
on 5 Apr 2013 at 7:45
Original issue reported on code.google.com by
albe...@conference-compass.com
on 10 Sep 2012 at 9:17