There's no need to start issuing warnings.
This stuff has never been released GA.
The correct order for this processing is
(and should always have been - if the user is explicit, do what they want):
1) Any class specified on the list element (like above) - new collection
2) Any class specified on the parent element (the typeInfo passed into getValue),
e.g.
| <property name="blah" class="java.util.ArrayList"><list/></property>
| - new collection
3) The getter - use the returned collection (if any)
4) the default collection type - new collection
The only reason for the preinstantiated flag would be to turn off (3)
but you can always do this anyway by using (1) or (2).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060437#4060437
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060437
"alesj" wrote :
| I'll turn the 'preinstantiate' to false by default.
| So this will then work out-of-the-box.
| And if you explicitly tell to use preinstantiated, then the class attribute will be ignored in the case getter returns non null instance.
The only issue is that the behaviour will change.
Those who used preinstantiated instances before by default, should now explicitly mark them preinstantiate='true'.
I can issue a big fat log warning. :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060430#4060430
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060430
"adrian(a)jboss.org" wrote : In fact, the solution should really be that the type specified on the collection
| overrides this feature. But currently this is not the case.
|
| i.e. the following should always create a new array list not use the getter.
|
|
| | <?xml version="1.0" encoding="UTF-8"?>
| |
| | <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| | xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
| | xmlns="urn:jboss:bean-deployer:2.0">
| |
| |
| | <bean name = "Manager" class = "PluginManager">
| | <property name = "bootstrapPlugins">
| | <list elementClass = "java.lang.String" class="java.util.ArrayList">
| | <value>Test</value>
| | </list>
| | </property>
| | </bean>
| |
| | </deployment>
| |
I'll turn the 'preinstantiate' to false by default.
So this will then work out-of-the-box.
And if you explicitly tell to use preinstantiated, then the class attribute will be ignored in the case getter returns non null instance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060425#4060425
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060425
In fact, the solution should really be that the type specified on the collection
overrides this feature. But currently this is not the case.
i.e. the following should always create a new array list not use the getter.
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
| xmlns="urn:jboss:bean-deployer:2.0">
|
|
| <bean name = "Manager" class = "PluginManager">
| <property name = "bootstrapPlugins">
| <list elementClass = "java.lang.String" class="java.util.ArrayList">
| <value>Test</value>
| </list>
| </property>
| </bean>
|
| </deployment>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060416#4060416
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060416
There's no way to check whether a collections is modifiable or otherwise.
But it should certainly be possible to turn this feature off,
with something like the requiresNew attribute on the collection below.
i.e. don't use the getter as the source of the collection to modify
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
| xmlns="urn:jboss:bean-deployer:2.0">
|
|
| <bean name = "Manager" class = "PluginManager">
| <property name = "bootstrapPlugins">
| <list elementClass = "java.lang.String" requiresNew="true">
| <value>Test</value>
| </list>
| </property>
| </bean>
|
| </deployment>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060405#4060405
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060405