#50 Custom Conversion of Member Value

closed
5
2007-02-09
2006-04-26
Jon Kofal
No

I have DTOA and DTOB

At the end of my conversion I'd like to see this:

DTOA.land="Deutschland"

DTOB.country="Germany"

I've looked at the CustomConverter and it seems to
only work at the Class-level.

What I'd like is to be able to write and declare a
Member-level CustomConverter that would allow me to
make a call to my 'CodeMap' Component to to this
conversion.

Is this supported and I just can't figure it out, or
is this a reasonable feature request or is it
something I sould just forget about (not really an
option).

Thanks
Jon K

Discussion

  • Jon Kofal

    Jon Kofal - 2006-04-28

    Logged In: YES
    user_id=1022472

    Hi Franz,

    Without thinking of Events, what I see as a straightforward
    solution is a Mapping Attribute on the <field> Element that
    defines a Converter to be used to obtain the value of the
    Object.member.

    <field custom-converter="MyFieldConverter">
    <a>land</a>
    <b>country</b>
    </field>

    class MyFieldConverter implements FieldConverter {
    public Object convert(Object sourceObject, Object
    destObject, String sourceFieldName, Object
    sourceFieldValue) {
    //do code table lookup here
    }
    }

    I guess the DozerEvent implementation would be able to
    solve this problem at first look, but I'd be concerned
    about the performance unless the firing of Events is false
    for a field by default.

    Until there's a solution in Dozer, I'll either post-process
    the Objects I create to do the code table lookups (easy but
    ugly) or hack at the Dozer Source (hard, pretty, but
    perhaps leading to compatability problems with future
    releases).

    Do you know of any Mapping frameworks that support this
    already?

    Jon K

     
  • Franz Garsombke

    Franz Garsombke - 2006-04-28

    Logged In: YES
    user_id=550744

    As long as <a>land</a> and <b>country</b> class types are
    defined as a custom converter we should be able to handle
    this. Are you not seeing that behavior?

    thanks,

    franz

     
  • Franz Garsombke

    Franz Garsombke - 2006-04-28
    • assigned_to: nobody --> fgarsombke
     
  • Franz Garsombke

    Franz Garsombke - 2006-04-28

    Logged In: YES
    user_id=550744

    This will be implemented in the next relese.

     
  • Matt Tierney

    Matt Tierney - 2006-11-13
    • assigned_to: fgarsombke --> mhtierney
     
  • Matt Tierney

    Matt Tierney - 2006-12-21

    Logged In: YES
    user_id=1236069
    Originator: NO

    This functionality has been added and will be released with 2.5

     
  • Matt Tierney

    Matt Tierney - 2006-12-21
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-01-24

    Logged In: YES
    user_id=1236069
    Originator: NO

    touch

     
  • SourceForge Robot

    • status: pending --> closed
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 45 days (the time period specified by
    the administrator of this Tracker).

     
  • Matt Tierney

    Matt Tierney - 2007-02-05
    • status: closed --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-02-05

    Logged In: YES
    user_id=1236069
    Originator: NO

    moving back to pending

     
  • Matt Tierney

    Matt Tierney - 2007-02-09
    • status: pending --> closed
     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks