You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2012/01/26 01:51:19 UTC

svn commit: r1236005 - in /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc: annotations/Optional.java def/ContributionDef3.java

Author: hlship
Date: Thu Jan 26 00:51:18 2012
New Revision: 1236005

URL: http://svn.apache.org/viewvc?rev=1236005&view=rev
Log:
Small documentation tweak about the @Optional annotation

Modified:
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Optional.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef3.java

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Optional.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Optional.java?rev=1236005&r1=1236004&r2=1236005&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Optional.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/Optional.java Thu Jan 26 00:51:18 2012
@@ -1,4 +1,4 @@
-// Copyright 2011 The Apache Software Foundation
+// Copyright 2011, 2012 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -23,9 +23,11 @@ import static java.lang.annotation.Reten
 
 /**
  * Marks a service contribution method within a module as being optional: it is not an error if the contribution does not match against an actual service. In that case, the
- * method will simply never be invoked.
+ * method will simply never be invoked. This is occasionally useful when a module is designed to work with another module <em>if the second module is present</em>. Without
+ * optional contributions, you would see hard errors when registry is created, and have to create a layer cake of small modules to prevent such errors.
  *
  * @see Contribute
+ * @see org.apache.tapestry5.ioc.def.ContributionDef3#isOptional()
  * @since 5.3
  */
 @Target(METHOD)

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef3.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef3.java?rev=1236005&r1=1236004&r2=1236005&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef3.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/def/ContributionDef3.java Thu Jan 26 00:51:18 2012
@@ -1,4 +1,4 @@
-// Copyright 2011 The Apache Software Foundation
+// Copyright 2011, 2012 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,8 +19,12 @@ package org.apache.tapestry5.ioc.def;
  * Starting in Tapestry 5.3, contributions could be optional.
  *
  * @since 5.3
+ * @see org.apache.tapestry5.ioc.annotations.Optional
  */
 public interface ContributionDef3 extends ContributionDef2
 {
+    /** Is this contribution optional, meaning it is not an error if the service to which the contribution is targetted
+     * does not exist.
+     */
     boolean isOptional();
 }