Author: gavin.king(a)jboss.com
Date: 2009-10-23 20:50:29 -0400 (Fri, 23 Oct 2009)
New Revision: 4248
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/Alternative.java
Log:
finish javadoc for @Alternative
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Alternative.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Alternative.java 2009-10-24
00:06:03 UTC (rev 4247)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Alternative.java 2009-10-24
00:50:29 UTC (rev 4248)
@@ -31,10 +31,41 @@
* applied to a bean class, producer method or field
* or {@linkplain javax.enterprise.inject.Stereotype stereotype}.</p>
*
- * <p>An alternative must be explicitly declared in the
- * <tt>beans.xml</tt> file if it should be available for
- * lookup, injection or EL resolution.</p>
+ * <pre>
+ * @Alternative
+ * public class MockOrder extends Order { ... }
+ * </pre>
*
+ * <p>An alternative is never available for injection,
+ * lookup or EL resolution in a Java EE module or library
+ * that is not a bean deployment archive (a module or
+ * library with no <tt>beans.xml</tt> file).</p>
+ *
+ * <p>Nor is an alternative available for injection, lookup
+ * or EL resolution in every bean deployment archive. An
+ * alternative must be explicitly <em>selected</em> in every
+ * bean deployment archive in which the alternative should
+ * be available for injection, lookup and EL resolution.</p>
+ *
+ * <p>By default, a bean deployment archive has no selected
+ * alternatives. An alternative must be explicitly declared
+ * using the <tt><alternatives></tt> element of the
+ * <tt>beans.xml</tt> file of the bean deployment archive.</p>
+ *
+ * <p>The <tt><alternatives></tt> element contains a
+ * list of bean classes and stereotypes. An alternative is
+ * selected for the bean deployment archive if either:</p>
+ *
+ * <ul>
+ * <li>the alternative is a managed bean or session bean and
+ * the bean class of the bean is listed,</li>
+ * <li>the alternative is a producer method, field or resource,
+ * and the bean class that declares the method or field is listed,
+ * or</li>
+ * <li>any {@link javax.enterprise.inject.Alternative @Alternative}
+ * stereotype of the alternative is listed.</li>
+ * </ul>
+ *
* @author Gavin King
* @author Pete Muir
*/
Show replies by date