You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Wu, Chien-Hsing" <CW...@QuadraMed.com> on 2004/04/27 16:52:53 UTC

[PATCH] betwixt support for derived interfaces

Hi,

 

I sent out the attached email below to a betwixt developer a while ago. That
email details the problem I faced when using betwixt. 

 

Patch.diff contains the changes I made. org.commons.betwixt.interfaces
contains the JUnit test code.

 

Can someone tell me how would I know if this patch is rejected or accepted?

 

Thanks,

 

 

Chien-Hsing Wu

QuadraMed Corporation

(703)709-2431

cwu@quadramed.com <ma...@quadramed.com> 

 

-----Original Message-----
From: Wu, Chien-Hsing 
Sent: Wednesday, April 14, 2004 12:57 PM
To: 'tobrien@apache.org'
Subject: betwixt question

 

Hi,

 

Pardon my intrusion but I am trying to use betwixt and came across a problem
that I could not find any answers on the web. I saw that you are listed in
the team web page of the betwixt site so I'd thought I'll ask you directly. 

 

I have a plural property in the top level bean whose type is an interface
with multiple base interfaces, like the following code:

 

package com.mystuff;

 

public class RootBean implements IContainer {

            public IContainer[] getChildren() {

}

            

public void addChild(IContainer child) {

}

}

 

public interface IContainer entends IEnv, IService {

            public IContainer[] getChildren();

            public void addChild(IContainer child);

}

 

I set RootBean.betwixt like:

 

<element name='Root'>

            <element name='pot' property='children' type='com.mystuff.Pot'>

            <element name='belly' property='children'
type='com.mystuff.Belly'>

</element>

 

after went through the source code and found that I can set the property
type using the type attribute in <element>. I was hoping that in doing so
ElementDescriptors for the element 'pot' is derived from com.mysutff.Pot not
com.mystuff.IContainer when reading from an XML file. The reason for that is
IContainer is an interface and Java Introspector does not return all
properties of an interface, including its base interfaces. I could not use
ClassNormalizer since it's only used when writing beans out and it can only
map from one class to another.

 

And it did not work as I hoped. After dig in the code more I found that the
type of the property in my betwixt file is overwritten by the call to
ElementRule.configureDescriptor -> XMLIntrospectorHelper.configureProperty
and XMLIntrospectorHelper.defaultAddMethods. Moreover,
XMLIntrospectorHelper.defaultAddMethods also overwrites updater.

 

Can you tell me if this over writing behavior is intended or not? If not,
what's the expected behavior?

 

 

Thank you for your valuable input.

 

 

Chien-Hsing Wu

QuadraMed Corporation

(703)709-2431

cwu@quadramed.com <ma...@quadramed.com>