[ 
https://issues.apache.org/jira/browse/HIVEMIND-200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473735
 ] 

Ilya Zverev commented on HIVEMIND-200:
--------------------------------------

Suddenly I found this bug in Hivemind project, but actually it's bug in 
Tapestry framework, not in hivemind.
The problem is that Tapestry always sends Object.class as required object type 
to hivemind, instead of using actual property type from the component template.

> Hivemind configuration injection always produces a List
> -------------------------------------------------------
>
>                 Key: HIVEMIND-200
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-200
>             Project: HiveMind
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: 1.1.1
>            Reporter: Ilya Zverev
>
> Suppose we need to create <configuration> in hivemodule.xml which holds a 
> simple map. As the documentation states, all we need is to specify 
> key-attribute parameter and write a simple translating rule.
> Then in .jwc we write something like this:
> <inject property="map" object="configuration:somemodule.ConfigMap"/>
> <component id="test" type="Insert">
>     <binding name="value" value="map.get('someKey')"/>
> </component>
> ...and happily receive an OGNLException informing us that 'someKey' can 
> hardly be converted into a number.
> That's because injected configurations is always injected as List even when 
> the magic parameter key-attribute is specified. With abstract property 
> accessor of type Map we receive another exception requiring to change method 
> return parameter to something like List.
> The source of this problem lies somewhere in InjectValueTranslatorImpl that 
> passes Object.class as the parameter type to ObjectTranslator. I suppose 
> there must be not Object.class but a real property class received from 
> EnhancementWorker.
> For now I've created a special translation prefix "configuration-map" that 
> returns Map if required parameter type can be assigned from Map, but I'm 
> looking forward to bugfix :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to