[seam-dev] XML Extensions
Stuart Douglas
stuart at baileyroberts.com.au
Sat Jan 16 19:19:04 EST 2010
I have just commited my XML extensions to https://svn.jboss.org/repos/seam/modules/xml/trunk/ and I would like a bit of feedback on some of the changes I have made and would like make to the syntax specified in the original web beans spec. Details are below:
Syntax for producer beans (implemented)
The original spec used this syntax:
<ns:Bean>
<ns:field>
<Producer>
<ns:SomeQualifier/>
</Producer>
</ns:field>
</ns:Bean>
I have changed this to:
<ns:Bean>
<ns:field>
<Producer/>
<ns:SomeQualifier/>
</ns:field>
</ns:Bean>
Setting initial field values (implemented):
You can now do:
<ns:Bean>
<ns:field>
<Producer/>
<value>10</value>
</ns:field>
<ns:field2>5</ns:field2>
<ns:mapField>
<entry><key>a</key><value>b</value></entry>
<e><k>c</k><v>d</v></e>
</ns:mapField/>
</ns:Bean>
The value key and entry tags can be shorted to just <v><k> and <e> tags, not sure if this is a good idea or not. I would also like to add the ability to set field values using EL.
Vetoing beans using XML (implemented)
Syntax is:
<veto>
<ns:Bean1/>
<ns:Bean2/>
</veto>
Replacing and extending Beans (not implemented)
I would like to add <override> and <extends> tags that can be added as a direct child of a Bean element. The override tag will have the same effect as the veto tag above, i.e. preventing the default bean from being installed. The <extends> tag specifies that the annotation and configuration is added to the existing Bean definition instead of installing a new bean.
Change of syntax for constructor and method parameters (not implemented)
Currently method parameters are specified as direct children of the method like so:
<ns:Bean>
<ns:method>
<Producer/>
<ns:ParamType1><ns:SomeAnntation/></ns:ParamType1>
<ns:SomeOtherAnnotation/>
<ns:ParamType2/>
</ns:method>
</ns:Bean>
I think this is a bit confusing, as parameters and annotations can be interspeced at random and it is not immeditatly obvious which is which. I think it should be changed to:
<ns:Bean>
<ns:method>
<Producer/>
<ns:SomeOtherAnnotation/>
<parameters>
<ns:ParamType1><ns:SomeAnntation/></ns:ParamType1>
<ns:ParamType2/>
</parameters/>
</ns:method>
</ns:Bean>
Something similar should probably be done for the constructor parameters as well.
Factories for primitive types (not implemented)
<factory>
<String/>
<ns:SomeQualifier/>
<value>hello world</value>
</factory>
This would allow you to the inject a string with the qualifier @SomeQualifier.
Thoughts?
Stuart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20100117/8e6d055a/attachment.html
More information about the seam-dev
mailing list