#135 Config Param for Custom Converter

Dozer v.4.3
closed
5
2008-12-02
2008-04-03
Assaf Smith
No

Allow adding a simple String configuration value for Custom Converters.
See example below:

<mapping>
<class-a>com.SimpleObj</class-a>
<class-b>com.SimpleObjPrime2</class-b>
<field custom-converter="com.MyCustomConverter" configString="someStringValue">
<a>field1</a>
<b>field1Prime</b>
</field>
</mapping>

This configString should be passed to the Custom Converter API as below:

public Object convert(Object destination, Object source, Class destClass, Class sourceClass, String configString)

Such a feature would tremendously enhance the capabilities of Custom Converters. Moreover, it would prevent us from having to write a separate Custom Converter for "similar" fields of the same type.

10x

Discussion

  • dmitry (lv)

    dmitry (lv) - 2008-09-30

    If you are using Spring or any other Inversion of Control container it is possible to instantiate Converters with necessary constructor arguments thus reusing parametrized converters. Custom converters could be provided to DozerBeanMapperFactory.

    I would suggest using this approach as a workaround for now.

     
  • dmitry (lv)

    dmitry (lv) - 2008-12-02
    • labels: --> Mapping Process Improvement
    • milestone: --> Dozer v.4.3
    • assigned_to: nobody --> buzdin
    • status: open --> closed
     
  • dmitry (lv)

    dmitry (lv) - 2008-12-02

    This feature is implemented and will be available in Dozer 4.3 release.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks