[jboss-cvs] JBossAS SVN: r90085 - projects/microcontainer/mcdocs/trunk/userguide/src/main/docbook.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 11 07:49:04 EDT 2009


Author: kabir.khan at jboss.com
Date: 2009-06-11 07:49:04 -0400 (Thu, 11 Jun 2009)
New Revision: 90085

Modified:
   projects/microcontainer/mcdocs/trunk/userguide/src/main/docbook/User_Guide.xml
Log:
@StringValue.type is a Class, not a String

Modified: projects/microcontainer/mcdocs/trunk/userguide/src/main/docbook/User_Guide.xml
===================================================================
--- projects/microcontainer/mcdocs/trunk/userguide/src/main/docbook/User_Guide.xml	2009-06-11 11:45:25 UTC (rev 90084)
+++ projects/microcontainer/mcdocs/trunk/userguide/src/main/docbook/User_Guide.xml	2009-06-11 11:49:04 UTC (rev 90085)
@@ -1511,7 +1511,7 @@
 }
 
 @Constructor
-public TestConstructorBean(@StringValue("this is a test constructor") String testString, @StringValue(value="25", type="long") long testNumber) {
+public TestConstructorBean(@StringValue("this is a test constructor") String testString, @StringValue(value="25", type=Long.TYPE) long testNumber) {
     ...
 }</programlisting>
             <programlisting role="XML">&lt;bean name=&quot;Test&quot; class=&quot;org.jboss.example.constructor.TestConstructorBean&quot;&gt;
@@ -1744,7 +1744,7 @@
 &lt;/bean&gt; </programlisting>
         <para>As you have probably noticed we are required to enter all of our values as strings since we are dealing with text files. These strings are converted into objects of the correct type using JavaBean <ulink url="http://java.sun.com/j2se/1.5.0/docs/api/java/beans/PropertyEditor.html">PropertyEditors</ulink>. If the property takes an interface or abstract class then you can pass a specific implementation using a <code>type</code> or  <code>class</code> attribute depending on whether you&apos;re using annotations or XML.</para>
         <programlisting role="JAVA">public class PropertiesBean {
-    public void setNumber(@StringValue(value=&quot;4&quot;, type=&quot;java.lang.Long&quot;) Number number) {
+    public void setNumber(@StringValue(value=&quot;4&quot;, type=java.lang.Long.class) Number number) {
         ...
    }
 }</programlisting>
@@ -1802,7 +1802,7 @@
     &lt;/property&gt;
 &lt;/bean&gt; </programlisting>
         <para>This is primarily used when configuring values representing collections such as lists, sets and arrays. Elements of a collection are defined by listing annotations or nesting &lt;value&gt; elements as follows:</para>
-        <programlisting role="JAVA">@CollectionValue(elementClass=&quot;java.lang.String&quot;,
+        <programlisting role="JAVA">@CollectionValue(elementClass=java.lang.String.class,
                  {@Value(string=@StringValue(&quot;string1&quot;)),
                   @Value(string=@StringValue(&quot;string2&quot;)),
                   @Value(string=@StringValue(&quot;string3&quot;)),
@@ -1821,7 +1821,7 @@
     &lt;/property&gt;
 &lt;/bean&gt; </programlisting>
         <para>The <code>elementClass</code> attribute specifies the default class for the values. This can be overriden for individual values using the <code>type</code> or <code>class</code> attributes.</para>
-        <programlisting role="JAVA">@CollectionValue(elementClass=&quot;java.lang.String&quot;,
+        <programlisting role="JAVA">@CollectionValue(elementClass=java.lang.String.class,
                  {@Value(string=@StringValue(&quot;string1&quot;)),
                   @Value(string=@StringValue(&quot;string2&quot;)),
                   @Value(string=@StringValue(value=&quot;3.0&quot;, type=&quot;java.lang.Float&quot;)),
@@ -1843,21 +1843,21 @@
           <para>The type of each value must be specified using either the <code>elementClass</code> or <code>type/class</code> attribute in order for the collection to be created.</para>
         </warning>
         <para>Lists, sets and arrays take the same form as the collection annotation and XML element. </para>
-        <programlisting role="JAVA">@ListValue(elementClass=&quot;java.lang.String&quot;,
+        <programlisting role="JAVA">@ListValue(elementClass=java.lang.String.class,
            {@Value(string=@StringValue(&quot;my first string&quot;)),
             @Value(string=@StringValue(&quot;my second string&quot;))})
 public void setList(List list) {
     ...
 }
 
- at SetValue(elementClass=&quot;java.lang.Integer&quot;,
+ at SetValue(elementClass=java.lang.Integer.class,
           {@Value(string=@StringValue(&quot;50&quot;)),
            @Value(string=@StringValue(&quot;55&quot;))})
 public void setSet(Set set) {
     ...
 }
 
- at ArrayValue(elementClass=&quot;java.lang.Float&quot;,
+ at ArrayValue(elementClass=java.lang.Float.class,
             {@Value(string=@StringValue(&quot;1.0&quot;)),
              @Value(string=@StringValue(&quot;2.0&quot;))})
 public void setArray(Object[] array) {
@@ -1886,9 +1886,9 @@
     &lt;/array&gt;
 &lt;/bean&gt; </programlisting>
         <para>They can even be nested within one another if required. </para>
-        <programlisting role="JAVA">@ListValue(elementClass=&quot;java.lang.String&quot;,
+        <programlisting role="JAVA">@ListValue(elementClass=java.lang.String.class,
            {@Value(string=@StringValue(&quot;my first string&quot;)),
-            @Value(string=@SetValue(elementClass=&quot;java.lang.Integer&quot;,
+            @Value(string=@SetValue(elementClass=java.lang.Integer.class;,
                                     {@Value(string=@StringValue(&quot;1&quot;)),
                                      @Value(string=@StringValue=&quot;2&quot;))})
                   )})
@@ -1909,8 +1909,8 @@
     &lt;/property&gt;
 &lt;/bean&gt;</programlisting>
         <para>Maps can also be created using multiple entries of key/value pairs. As we now have two types to consider we must use the <code>keyClass</code> and <code>valueClass</code> attributes to specify the default classes for each entry. Again these can be overriden for individual entries if necessary.</para>
-        <programlisting role="JAVA">@MapValue(keyClass=&quot;java.lang.String&quot;,
-          valueClass=&quot;java.lang.String&quot;,
+        <programlisting role="JAVA">@MapValue(keyClass=java.lang.String.class,
+          valueClass=java.lang.String.class;,
           {@EntryValue(key=@Value(string=@StringValue(&quot;foo.bar.key&quot;)),
                        value=@Value(string=@StringValue(&quot;QWERT&quot;))),
            @EntryValue(key=@Value(string=@StringValue(&quot;xyz.key&quot;)),
@@ -1952,8 +1952,8 @@
           </listitem>
         </itemizedlist>
         <para>If you want to override this behaviour and specify your own class then you can simply add a <code>clazz</code> attribute to your annotation or <code>class</code> attribute to your XML element containing the fully-qualified class name. This causes the microcontainer to create a new instance using the specified class.</para>
-        <programlisting role="JAVA">@SetValue(clazz=&quot;java.util.TreeSet&quot;,
-          elementClass=&quot;java.lang.Integer&quot;,
+        <programlisting role="JAVA">@SetValue(clazz=java.util.TreeSet.class,
+          elementClass=java.lang.Integer.class,
           {@Value(string=@StringValue(&quot;50&quot;)),
            @Value(string=@StringValue(&quot;55&quot;))})
 public void setSet(Set set) {




More information about the jboss-cvs-commits mailing list