commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Inger, Matthew" <>
Subject RE: [betwixt] Inheritance version 2
Date Tue, 01 Jun 2004 11:31:10 GMT
One of the things i've run into in my refactoring is this:

I've create a utility class to add the inherited descriptors
to an XMLBeanInfo class:

	public static void addInheritance(XMLBeanInfoRegistry registry,
               XMLBeanInfo info,
               InheritType type);

where InheritType is an enumerated style class.

However, when i make a call in the InfoRule to:

getXMLInfoDigester().getXMLIntrospector(), this comes
up as null when running the test cases, and thus i get
a null pointer exception when trying to get the
registry from there.  I can send you the details later,
as i don't have the code available at this moment (it's at home).

It doesn't seem right that the introspector is null.  In a real
scenario, this would always be set, correct?

The reason i expect the registry is so that the user can pick and
choose the inheritance they want.  If A extends B extends C,
then they would first have to add the inheritance from C to B,
and then from B to A (as they would with the XML).  In order to
get full inheritance.

But to get the full inheritance in that case, we need to use the
same registry instance.

Any suggestions?

-----Original Message-----
From: robert burrell donkin
Sent: Sunday, May 30, 2004 6:53 AM
To: Jakarta Commons Developers List
Subject: Re: [betwixt] Inheritance version 2

On 30 May 2004, at 06:14, Inger, Matthew wrote:

> The other question is, is this the right approach?

betwixt is the sort of component where users appreciate different ways 
to achieve the same goals. i've been often surprised by innovative uses 
such features have been put to.

so, the question i usually ask myself is: is this a reasonable 
approach? if so, then that's usually good enough for me.

> It is an XML only solution, and would require the
> user to do this manually if building their mapping
> in code (does anyone ever do this?),

yes. there are some very powerful tricks you can do by rolling your own 

> or when just
> introspecting without a mapping of any sort.
> Perhaps a utility class to do the inheritance,
> along with another method on the introspector
> to allow them to introspect and include inheritance
> might be in order.  I will explore this.

it usually works out that you want this as well. in the end, though, it 
usually ends up that you want a pluggable strategy on introspector so 
that users can programmatically choose which classes should inherit. so 
it's probably best going straight for that. it's best to implementation 
the logical strategy interface as an abstract class (since methods can 
then be added without breaking backwards compatibility.

- robert

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message