#33 set/get method for last field in deep-chain

closed
None
5
2007-04-04
2006-03-22
No

Hi,

A bug has been opened (number 1441312) and recently
deleted on this subject.

The problem can be explained with the following mapping :

...
<field>
<A>addresses</A>
<B theSetMethod="addAddress"
type="iterate">society.addresses</B>
<sourceTypeHint>oa.Address</sourceTypeHint>
<destinationTypeHint>otd.AddressOTD</destinationTypeHint>
</field>
...

In this example, the custom set method is supposed to
be defined for the "addresses" attribute (this is the
way we interpreted it) and no custom methods can be
defined for the society attribute.

As Franz said in the bug 1441312 comments, there is no
way to detect if a custom set or get method has been
defined for the intermediate attributes of the
deep-mapping (only "society" here). So for those, only
standard javabean accessors can be accepted.

Currently, mixed deep-mapping and custom set methods is
not allowed (it does not works).

Is it possible to accept set/get methods on a
deep-mapping field and use these methods only for the
last attribute of the deep-field chain of attributes
(all intermediate attributes must then respect javabean
rules for get/set methods) instead of prevent the mix ?

Such a rule would be sufficient for us.

Thanks,

Richard.

Discussion

  • seb

    seb - 2006-05-02

    Logged In: YES
    user_id=1326867

    Hi,

    i'm currently testing the 2.2 release of Dozer. There's so
    much features : i really can't use them all in one project :)
    But in fact, i'm really waiting for the feature above ...
    Because of our home-made framework, we're really going to a
    dead-end without it ! :'(

    Seb, waiting for the next release ;)

     
  • Franz Garsombke

    Franz Garsombke - 2006-05-02

    Logged In: YES
    user_id=550744

    For you Seb...anything. How about I add this feature in the
    next day or so and I can get you an unofficial release...?

    Franz

     
  • Franz Garsombke

    Franz Garsombke - 2006-05-02
    • assigned_to: nobody --> fgarsombke
     
  • Franz Garsombke

    Franz Garsombke - 2006-05-03

    Logged In: YES
    user_id=550744

    Will this fix work. We use the property descriptors in the
    deep hiearchy. In this example if you have a setMethod
    called setCustom() and a get method called getCustom() you
    will be ok. The actual attribute can be named anything.

    <b>description.custom</b>

    Let me know if this will help. If not...it might be pretty
    painful to implement since we deal in property descriptors
    and not attributes at the deep level.

     
  • seb

    seb - 2006-05-03

    Logged In: YES
    user_id=1326867

    Hi Franz,

    i'm already ok for an unofficial release ;)
    Your last fix doesn't work for me, because i'm using a
    custom setMethod (called addXXX), which is also iterative !
    You can take a look at the example provided by Richard.
    Do you want a class diagram ?

    See you

     
  • Franz Garsombke

    Franz Garsombke - 2006-05-03

    Logged In: YES
    user_id=550744

    So...I got this working with a custom set method/iterate. I
    did not have time to get a custom get method working.

    Here is what the mapping looks like:

    <field>
    <a>customSetGetMethod</a>
    <b set-method="setCustom"
    type="iterate">description.customSetGetMethod</b>
    <b-hint>net.sf.dozer.util.mapping.vo.Van</b-hint>
    </field>

    I have attached the jar. Let me know how it works.

     
  • seb

    seb - 2006-05-04

    Logged In: YES
    user_id=1326867

    Well...I tried with the attached jar and here are my
    conclusions :
    * it seems to be ok that with one level (like in your example)
    * it crashes if there's two levels (in your example, replace
    description.customSetGetMethod with
    description.description2.customSetGetMethod)
    * there's maybe something else to lookout in our framework
    ... we're not using standard JavaBeans, and I think there's
    something wrong with this ...

    I can send you a little Java project (under Eclipse) with my
    tests if you want.

    Thx for all
    Bye
    Seb

     
  • Franz Garsombke

    Franz Garsombke - 2006-05-05

    Logged In: YES
    user_id=550744

    Send your eclise project along and I will try to get to the
    bottom of this. Do I need to know French? :)

     
  • Matt Tierney

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

    Matt Tierney - 2007-04-01

    Logged In: YES
    user_id=1236069
    Originator: NO

    This has been fixed. It resulted as a side effect of some recent property descriptor cleanup.

     
  • Matt Tierney

    Matt Tierney - 2007-04-01
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-04-04
    • 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