Author: swd847
Date: 2010-04-26 07:30:33 -0400 (Mon, 26 Apr 2010)
New Revision: 12643
Modified:
modules/xml/trunk/docs/en-US/master.xml
modules/xml/trunk/docs/en-US/xml-general.xml
modules/xml/trunk/docs/en-US/xml-introduction.xml
Log:
minor doc update
Modified: modules/xml/trunk/docs/en-US/master.xml
===================================================================
--- modules/xml/trunk/docs/en-US/master.xml 2010-04-26 10:39:46 UTC (rev 12642)
+++ modules/xml/trunk/docs/en-US/master.xml 2010-04-26 11:30:33 UTC (rev 12643)
@@ -6,7 +6,6 @@
<toc/>
<title>Seam XML Configuration</title>
- <xi:include href="xml-introduction.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="xml-general.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
\ No newline at end of file
Modified: modules/xml/trunk/docs/en-US/xml-general.xml
===================================================================
--- modules/xml/trunk/docs/en-US/xml-general.xml 2010-04-26 10:39:46 UTC (rev 12642)
+++ modules/xml/trunk/docs/en-US/xml-general.xml 2010-04-26 11:30:33 UTC (rev 12643)
@@ -39,12 +39,12 @@
<s:Qualifier/>
</test:ProducerQualifier>
- <test:ProducerBean>
- <test:value>
+ <test:ProducerBean someOtherField="45" >
+ <test:someField>
<s:Produces/>
<test:ProducerQualifier/>
<s:value>hello world</s:value>
- </test:value>
+ </test:someField>
</test:ProducerBean>
<test:ReceiverBean>
@@ -80,12 +80,12 @@
<programlisting>
<![CDATA[
-<test:ProducerBean>
- <test:value>
+<test:ProducerBean someOtherField="45" >
+ <test:someField>
<s:Produces/>
<test:ProducerQualifier/>
<s:value>hello world</s:value>
- </test:value>
+ </test:someField>
</test:ProducerBean>
]]>
</programlisting>
@@ -96,10 +96,13 @@
<literal>ProducerBean</literal>, instead it installs a new bean. In
this instance there will be two <literal>ProducerBean</literal> CDI
beans.</para>
- <para>This bean has a field called <literal>value</literal>, this
field is configured to be a producer field using XML (it is also possible to configure
producer
+ <para>This bean has a field called <literal>someField</literal>,
this field is configured to be a producer field using XML (it is also possible to
configure producer
methods, more on this later). The
<literal><test:value/></literal> declaration has several child
elements. The <literal><s:Produces/></literal>
element tells the container that this is a producer field.
<literal><test:ProducerQualifier/></literal> element defines a
qualifier for the producer
field. The <literal><s:value></literal> element defines an
initial value for the field.</para>
+
+ <para>This bean also has another field called
<literal>someOtherField</literal> this field has it's value to to 45 using
a shorthand syntax. A field may not be specified
+ twice, trying to set the value using the shorthand syntax and the normal syntax will
result in an error.</para>
<para>Child elements of fields, methods and classes that resolve to Annotation
types are considered to be annotations on the corresponding element,
so the corresponding Java declaration for the XML above would be:</para>
@@ -108,7 +111,10 @@
public class ProducerBean {
@Produces
@ProducerQualifier
- public String value = "hello world";
+ public String someField = "hello world";
+
+ int someOtherField = 45;
+
}
]]></programlisting>
@@ -325,8 +331,8 @@
public int method(@Qualifier2 MethodValueBean[][] param) {//method body}
]]>
</programlisting>
- <para>Array parameters can be represented using the
<literal><s:array></literal> element, with a child element to
- represent the type of the array. E.g.</para>
+ <para>Array parameters can be represented using the
<literal><s:array></literal> element,
+ with a child element to represent the type of the array. E.g.</para>
<programlisting>
int method(MethodValueBean[] param);
</programlisting>
@@ -364,14 +370,14 @@
</test:SomeBean>
]]>
</programlisting>
-<para>In the example above only beans that are assinable to InjectedBean will be
eligable for injection into the field.
+<para>In the example above only beans that are assignable to InjectedBean will be
eligable for injection into the field.
This also works for parameter injection points.</para>
</section>
<section>
<title>Annotation Members</title>
- <para>It is also possible to set the value of annotation members. For
example:</para>
+ <para>It is possible to set the value of annotation members using
attributes in xml. For example:</para>
<programlisting>
<![CDATA[
public @interface OtherQualifier {
@@ -392,6 +398,35 @@
</programlisting>
<para>The value member can be set using the inner text of the node, as seen
in the first example.</para>
</section>
+
+ <section>
+ <title>Generic Beans</title>
+ <para>Gereric beans allow for multiple beans to be created from a single bean
definition. They are
+ designed for use by framework writers. From the users perspective there is no
+ special configuration required, if you configure a bean that a framework writer has
marked as a generic
+ bean then you will end up with multiple beans instead.</para>
+ <para>Generic beans are configured using the syntax described above. For every
bean that the user
+ configures, a corresponding bean from the generic bean declaration is created. For
example in the
+ framework xml configuration:</para>
+<programlisting>
+ <![CDATA[
+<s:genericBean class="org.jboss.seam.xml.test.generic.GenericMain" >
+ <test:GenericDependant>
+ <s:ApplyQualifiers/>
+ <s:specializes/>
+ <test:instance>
+ <s:ApplyQualifiers/>
+ </test:instance>
+ </test:GenericDependant>
+</s:genericBean>
+]]>
+ </programlisting>
+ <para>The declaration above means that for every
<literal>GenericMain</literal> that a user configures via xml
+ a corresponding <literal>GenericDependant</literal> is created as
well. The
+ <literal><s:ApplyQualifiers\></literal> is replaced
with the qualifiers that are present on the user
+ configured bean.</para>
+ </section>
+
<section>
<title>More Information</title>
Modified: modules/xml/trunk/docs/en-US/xml-introduction.xml
===================================================================
--- modules/xml/trunk/docs/en-US/xml-introduction.xml 2010-04-26 10:39:46 UTC (rev 12642)
+++ modules/xml/trunk/docs/en-US/xml-introduction.xml 2010-04-26 11:30:33 UTC (rev 12643)
@@ -36,7 +36,7 @@
public class RobotArm
{
- String attchment = "welder";
+ String attachment = "welder";
public void doStuff()
{
@@ -51,7 +51,7 @@
public @Interface RightArm{}
]]>
</programlisting>
- <para>This is all well and good, however at some point in the future we decide
that our robot is no longer needed for welding, instead it needs a plasma cutter in
it's left hand and a
+ <para>So we have a robot class that injects a left arm and a right arm, with
both arms having a welder attachment. At some point in the future we decide that our
robot is no longer needed for welding, instead it needs a plasma cutter in it's left
hand and a
vice in its right hand. Rather than modifying the class files, we decide to
configure this up with xml:</para>
<programlistingco>
<areaspec>
@@ -83,13 +83,13 @@
<r:RobotArm>
<s:overrides/>
<r:LeftArm/>
- <r:attchment>Plasma Cutter</r:attchment>
+ <r:attachment>Plasma Cutter</r:attachment>
</r:RobotArm>
<r:RobotArm>
<s:overrides/>
<r:RightArm/>
- <r:attchment>Vice</r:attchment>
+ <r:attachment>Vice</r:attachment>
</r:RobotArm>
<r:Robot>