beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Song (JIRA)" <beehive-...@incubator.apache.org>
Subject [jira] Closed: (BEEHIVE-149) Bean introspection fails for annotation-valued properties
Date Mon, 20 Jun 2005 19:53:17 GMT
     [ http://issues.apache.org/jira/browse/BEEHIVE-149?page=all ]
     
James Song closed BEEHIVE-149:
------------------------------


A test is added by r191545 and passes.

> Bean introspection fails for annotation-valued properties
> ---------------------------------------------------------
>
>          Key: BEEHIVE-149
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-149
>      Project: Beehive
>         Type: Bug
>   Components: Controls
>     Versions: V1Alpha
>     Reporter: Kyle Marvin
>     Assignee: James Song
>     Priority: Minor
>      Fix For: V1Beta

>
> BeanInfo introspection of a Control type that has a property that is based upon a JSR-175
annotation type will fail w/ an Introspection exception.   The following is a sample exception,
based upon the org.apache.beehive.controls.test.controls.basic.Hello test control included
in the checkin tests:
> Caused by: java.beans.IntrospectionException: Method not found: setGender
>         at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:93)
>         at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:53)
>         at org.apache.beehive.controls.test.controls.basic.HelloBeanBeanInfo.initPropertyDescriptors(HelloBeanBeanInfo.java:137)
>         at org.apache.beehive.controls.test.controls.basic.HelloBeanBeanInfo.getPropertyDescriptors(HelloBeanBeanInfo.java:149)
>         at java.beans.Introspector.getTargetPropertyInfo(Introspector.java:475)
>         at java.beans.Introspector.getBeanInfo(Introspector.java:385)
>         at java.beans.Introspector.getBeanInfo(Introspector.java:155)
> The rub is that the java.beans.PropertyDescriptor class expects to find a method with
the following signature:
>         public void setGender(Gender gender);
> while bean exposes the following instead:
>         public void setGender(PropertyMap genderMap);
> This is because it is impossible to 'new' a JSR-175 annotation type and initialize its
values, so the PropertyMap interface (and the corresponsing concrete impl, BeanPropertyMap)
exists to abstract a collection of annotation type property values.  You can create a BeanPropertyMap,
push values into it, and then use it to set the (annotation-typed) property.
> The fix is to modify the BeanInfo codegen to use the java.beans.PropertyDescriptor constructor
that takes actual java.lang.reflect.Methods as arguments, to explicitly specify the specific
setter method on the bean class instead of allowing PropertyDescriptor to use the default
algorithm.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message