thanks for the answer.. it's funny i don't recall bringing this up before
but my memory is pretty bad. :-)


yeah, i think this would be nice to have.  i'd definitely put the
standard collections support ahead (higher priority) of this.

i speak in terms of reflection because that's what i know but
i think that's what users would expect -- if a compatible method
exists, the framework should detect and use it.

thanks, eitan

by the way, i recently re-read the jibx documentation.
your design of the binding file, especially
the name/field attribute dichotomy (the ability to supply one or the
other or both) is absolutely beautiful.



On Apr 30, 2004, at 4:07 PM, Dennis Sosnoski wrote:

This is not always handled consistently in the current code. For collection methods, the code looks for an exact match on the method signature, expecting java.lang.Object to be passed or returned, checking both the current class and visible methods from superclasses. In the case of a collection.add-method this means it looks for a method with the supplied name taking a single parameter of type java.lang.Object.

The get/set method lookup for properties is more sophisticated, looking at assignability to find compatible methods. I remember you asked about doing the same for collections last fall, but it's one of the things that hasn't been high on the priority list because I'm afraid the change would have messy side-effects in the current code generation. This is another issue that should probably go in Jira as an enhancement for beta 4.

- Dennis

Eitan Suez wrote:

hello,

  a number of attributes in the binding schema take the name
  of a method as a parameter.  for example, collection.add-method

  i am curious as to how jibx/bcell actually look for that method.
  specifically here's what i'd like to know:

   a. will superclasses be searched or just the declared class?
   b. in the case of an add-method, will it look for methods with
    an argument that exactly matches the item-type or will
    it also look for methods with an argument that the item-type
    can be assigned to?

here's an example to make things clearer:

- class A has collection marbles() where item-type is Marble

Marble extends RoundRock

 - the collection type is not a standard java.util type but
   a custom class "MySpecialList".

- MySpecialList extends MyList (a custom base list type)

  MyList has the method:
     add(RoundRock roundrock);

  so back to class A, i have a collection of marbles that
  i've constructed possibly like this:

    MySpecialList marbles = new MySpecialList();
    marbles.add(new Marble(Color.red));
    marbles.add(new Marble(Color.green));
    A a = new A(marbles);

  i have a similar situation in my test code an i'm getting
  the error:
    "add-method add not found in collection type MySpecialList"

  i'm wondering whether the binding code goes as far as
  checking MyList and if so, whether it notices that its add
  method is kosher because
    RoundRock.class.isAssignableFrom(Marble.class);

thanks, eitan

ps:  sorry i guess i could look at the code but thought i could
 get a quick/easy answer this way..





-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to