You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Inger, Matthew" <In...@Synygy.com> on 2004/06/01 13:31:10 UTC

RE: [betwixt] Inheritance version 2

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
[mailto:robertburrelldonkin@blueyonder.co.uk]
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 
descriptors.

> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] Inheritance version 2

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
i have an idea what's causing this but i need to get the commons 
logging release candidate signed and shipped tonight so it'll have to 
be tomorrow.

- robert

On 1 Jun 2004, at 12:31, Inger, Matthew wrote:

> 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
> [mailto:robertburrelldonkin@blueyonder.co.uk]
> 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
> descriptors.
>
>> 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: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] Inheritance version 2

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi Matthew

On 1 Jun 2004, at 12:31, Inger, Matthew wrote:

> 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.

ok.

(i've developed a dislike of booch utilities over the last couple of 
years. everytime i've added one, i seem to come back in six months or a 
year and need to make a real object from it...)

> 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).

the code would be great :)

you might need to attach it to bugzilla (since the ASF is blocking a 
lot of attachments now)

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

yes, it should always be set. sounds like a bug to me.

> 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.

that sounds about right.

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

i'm not sure that i really understand this.

the XMLBeanInfoRegistry factors out the storage of already introspected 
XMLBeanInfo's from the introspector into a pluggable strategy. this 
allows developers (for example) to create sophisticated caching options 
(if they wish) and to pre-populate the registry with programmatically 
created XMLBeanInfo's.

it's therefore important to ensure that when the inheritance is being 
built up that the registry is checked. the functionality is built into 
the introspector so i don't really understand (at the moment) why the 
standard introspection calls on the introspector cannot be used to 
return XMLBeanInfo's for the ancesters but maybe i've missed something 
so please explain your reasoning.

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org