Finding BeanInfo for superclass?  
Author Message
Martha Goys





PostPosted: 2005-1-11 16:28:00 Top

java-programmer, Finding BeanInfo for superclass? Hi,

I'm having a problem or a misunderstanding with BeanInfo.
I have a class Alpha, and a class Beta. Beta extends Alpha. I've
created an AlphaBeanInfo class.

The following code works fine:

BeanInfo info = Introspector.getBeanInfo(Alpha.class);
...

Problem is though when I call the following code:

BeanInfo info = Introspector.getBeanInfo(Beta.class);
...

AlphaBeanInfo is not returned, nor are any of its methods called
(verified via debugging)

Shouldn't this be returned by the Introspector? I could of course write
a BetaBeanInfo, but this seems silly to have to do this.


Any ideas/clarifications?


Many thanks,

M
 
Martha Goys





PostPosted: 2005-1-27 15:53:00 Top

java-programmer >> Finding BeanInfo for superclass? Martha Goys wrote:
> I'm having a problem or a misunderstanding with BeanInfo.
> I have a class Alpha, and a class Beta. Beta extends Alpha. I've
> created an AlphaBeanInfo class.
>
> The following code works fine:
>
> BeanInfo info = Introspector.getBeanInfo(Alpha.class);
> ...
>
> Problem is though when I call the following code:
>
> BeanInfo info = Introspector.getBeanInfo(Beta.class);
> ...
>
> AlphaBeanInfo is not returned, nor are any of its methods called
> (verified via debugging)
>
> Shouldn't this be returned by the Introspector? I could of course write
> a BetaBeanInfo, but this seems silly to have to do this.
>

The workaround/solution I found was to have the class Alpha implement
BeanInfo interface.

-M