[seam-commits] Seam SVN: r13674 - modules/xml/trunk/docs/src/main/docbook/en-US.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Aug 31 06:55:58 EDT 2010


Author: swd847
Date: 2010-08-31 06:55:58 -0400 (Tue, 31 Aug 2010)
New Revision: 13674

Modified:
   modules/xml/trunk/docs/src/main/docbook/en-US/xml-general.xml
Log:
add section on virtual producer fields


Modified: modules/xml/trunk/docs/src/main/docbook/en-US/xml-general.xml
===================================================================
--- modules/xml/trunk/docs/src/main/docbook/en-US/xml-general.xml	2010-08-31 08:50:05 UTC (rev 13673)
+++ modules/xml/trunk/docs/src/main/docbook/en-US/xml-general.xml	2010-08-31 10:55:58 UTC (rev 13674)
@@ -521,6 +521,54 @@
     </section>
     
     <section>
+      <title>Virtual Producer Fields</title>
+      <para>
+         Seam XML supports configuration of virtual producer fields. These allow for configuration 
+         of resource producer fields, Weld Extensions generic bean and constant values directly via 
+         XML. First an exmaple:
+      </para>
+<programlisting role="XML" >
+<![CDATA[
+<s:EntityManager>
+  <s:Produces/>
+  <sPersistenceContext unitName="customerPu" />
+</s:EntityManager>
+
+<s:String>
+  <s:Produces/>
+  <my:VersionQualifier />
+  <value>Version 1.23</value>
+</s:String>
+]]>
+</programlisting>      
+      <para>
+         The first example configures a resource producer field. The second configures a bean
+         of type String, with the qualifier <literal>@VersionQualifier</literal> and the value
+         <literal>'Version 1.23'</literal>. The corresponding java for the above XML is:
+      </para>
+<programlisting role="java" >
+<![CDATA[
+public class SomeClass
+{
+
+  @Produces
+  @PersistenceContext(unitName="customerPu")
+  EntityManager field1;
+  
+  @Produces
+  @VersionQualifier
+  String field2 = "Version 1.23";
+
+}
+]]>
+</programlisting>       
+    <para>
+      Although these look superficially like normal bean declarations, the <literal>&lt;Produces&gt;</literal>
+      declaration means it is treated as a producer field instead of a normal bean.  
+    </para>
+    </section>
+    
+    <section>
         <title>More Information</title>
         <para>For further information look at the units tests in the seam-xml distribution, also the 
           JSR-299 Public Review Draft section on XML Configuration was the base for this extension, 



More information about the seam-commits mailing list