You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/04/05 16:26:55 UTC

svn commit: r645108 - in /tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations: Inject.java InjectService.java IntermediateType.java Primary.java Symbol.java Value.java

Author: hlship
Date: Sat Apr  5 07:26:55 2008
New Revision: 645108

URL: http://svn.apache.org/viewvc?rev=645108&view=rev
Log:
TAPESTRY-2258: Error while autobuilding BeanEditForm's bean

Added:
    tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java
      - copied, changed from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java
    tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java
      - copied, changed from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java
    tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java
      - copied, changed from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java
    tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java
      - copied, changed from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java
    tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java
      - copied, changed from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java
    tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Value.java
      - copied, changed from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Value.java

Copied: tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java (from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java?p2=tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java&p1=tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java&r1=645085&r2=645108&rev=645108&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Inject.java Sat Apr  5 07:26:55 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -14,9 +14,8 @@
 
 package org.apache.tapestry.ioc.annotations;
 
-import org.apache.tapestry.ioc.ObjectProvider;
-
 import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.PARAMETER;
 import java.lang.annotation.Retention;
@@ -24,24 +23,30 @@
 import java.lang.annotation.Target;
 
 /**
- * This annotation serves two similar purposes: it marks parameters that should be injected in the
- * IoC container, and it marks fields that should be injected inside Tapestry components.
+ * This annotation serves is something of the Swiss Army knife for operations related to injection of dependencies into
+ * an arbitrary method of Java Bean.
+ * <p/>
+ * <p>It marks parameters that should be injected in the IoC container, and it marks fields that should be injected
+ * inside Tapestry components.
  * <p/>
- * In terms of the IoC container; normally, resources take precedence over annotations when
- * injecting. The Inject annotation overrides this default, forcing the resolution of the parameters
- * value via the master {@link ObjectProvider}, even when the parameter's type matches a type that
- * is normally a resource. This is most often used in conjunction with {@link Value} annotation when
+ * In terms of the IoC container; normally, resources take precedence over annotations when injecting. The Inject
+ * annotation overrides this default, forcing the resolution of the parameters value via the master {@link
+ * org.apache.tapestry.ioc.ObjectProvider}, even when the parameter's type matches a type that is normally a resource.
+ * This is most often used in conjunction with {@link org.apache.tapestry.ioc.annotations.Value} annotation when
  * injecting a string, as normally, the String would be matched as the service id.
  * <p/>
- * In terms of the IoC container, the Inject annotation is only used on parameters to service
- * builder methods and constructors. However, inside Tapestry components (<em>and only inside components</em>),
- * it may be applied to fields. On fields that require injection, the Inject annotation is
- * <em>required</em>.
+ * In terms of the IoC container, the Inject annotation is only used on parameters to service builder methods (and
+ * contributor and decorator methods) and on module class constructors. constructors. However, inside Tapestry
+ * components (<em>and only inside components</em>), it may be applied to fields. On fields that require injection, the
+ * Inject annotation is <em>required</em>.
+ * <p/>
+ * Finally, on a constructor, this is used to indicate <em>which</em> constructor should be used when more than one is
+ * available.
  *
- * @see ObjectProvider
+ * @see org.apache.tapestry.ioc.ObjectProvider
  */
 @Target(
-        {PARAMETER, FIELD})
+        { PARAMETER, FIELD, ElementType.CONSTRUCTOR })
 @Retention(RUNTIME)
 @Documented
 public @interface Inject

Copied: tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java (from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java?p2=tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java&p1=tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java&r1=645085&r2=645108&rev=645108&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java Sat Apr  5 07:26:55 2008
@@ -1,17 +1,17 @@
-// Copyright 2006 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.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
+// Copyright 2006, 2008 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.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package org.apache.tapestry.ioc.annotations;
 
 import java.lang.annotation.Documented;
@@ -34,8 +34,8 @@
 {
 
     /**
-     * The id of the service to inject; either a fully qualified id, or the unqualified id of a
-     * service within the same module.
+     * The id of the service to inject; either a fully qualified id, or the unqualified id of a service within the same
+     * module.
      */
     String value();
 }

Copied: tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java (from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java?p2=tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java&p1=tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java&r1=645085&r2=645108&rev=645108&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/IntermediateType.java Sat Apr  5 07:26:55 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -18,14 +18,14 @@
 
 
 /**
- * Used to guide Tapestry when coercing from a raw type to a field or parameter type, by forcing
- * Tapestry to coerce to the intermediate type.  This was introduced to allow coercion from
- * string to a time period (in milliseconds) via {@link org.apache.tapestry.ioc.util.TimeInterval}.
+ * Used to guide Tapestry when coercing from a raw type to a field or parameter type, by forcing Tapestry to coerce to
+ * the intermediate type.  This was introduced to allow coercion from string to a time period (in milliseconds) via
+ * {@link org.apache.tapestry.ioc.util.TimeInterval}.
  *
  * @see org.apache.tapestry.ioc.annotations.Value
  * @see org.apache.tapestry.ioc.annotations.Symbol
  */
-@Target({ElementType.PARAMETER, ElementType.FIELD})
+@Target({ ElementType.PARAMETER, ElementType.FIELD })
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
 public @interface IntermediateType

Copied: tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java (from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java?p2=tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java&p1=tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java&r1=645085&r2=645108&rev=645108&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java Sat Apr  5 07:26:55 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -14,9 +14,6 @@
 
 package org.apache.tapestry.ioc.annotations;
 
-import org.apache.tapestry.ioc.services.ChainBuilder;
-import org.apache.tapestry.ioc.services.StrategyBuilder;
-
 import java.lang.annotation.Documented;
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.PARAMETER;
@@ -25,13 +22,13 @@
 import java.lang.annotation.Target;
 
 /**
- * Marker annotation used to denote a service that is the primary instance of some common interface.
- * This is often used when a service is a {@linkplain ChainBuilder chain of command} or
- * {@linkplain StrategyBuilder strategy-based} and, therefore, many services will implement the same
- * interface.
+ * Marker annotation used to denote a service that is the primary instance of some common interface. This is often used
+ * when a service is a {@linkplain org.apache.tapestry.ioc.services.ChainBuilder chain of command} or {@linkplain
+ * org.apache.tapestry.ioc.services.StrategyBuilder strategy-based} and, therefore, many services will implement the
+ * same interface.
  */
 @Target(
-        {PARAMETER, FIELD})
+        { PARAMETER, FIELD })
 @Retention(RUNTIME)
 @Documented
 public @interface Primary

Copied: tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java (from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java?p2=tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java&p1=tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java&r1=645085&r2=645108&rev=645108&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java Sat Apr  5 07:26:55 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -22,12 +22,12 @@
 import java.lang.annotation.Target;
 
 /**
- * Used to inject a symbol value, via a symbol name. This is used much like {@link Value}
- * annotation, except that symbols are not expanded ... the entire value is a symbol name. This
- * allows the annotation to reference a public constant variable.
+ * Used to inject a symbol value, via a symbol name. This is used much like {@link
+ * org.apache.tapestry.ioc.annotations.Value} annotation, except that symbols are not expanded ... the entire value is a
+ * symbol name. This allows the annotation to reference a public constant variable.
  */
 @Target(
-        {PARAMETER, FIELD})
+        { PARAMETER, FIELD })
 @Retention(RUNTIME)
 @Documented
 public @interface Symbol

Copied: tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Value.java (from r645085, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Value.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Value.java?p2=tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Value.java&p1=tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Value.java&r1=645085&r2=645108&rev=645108&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Value.java (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry/ioc/annotations/Value.java Sat Apr  5 07:26:55 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -14,9 +14,6 @@
 
 package org.apache.tapestry.ioc.annotations;
 
-import org.apache.tapestry.ioc.services.SymbolSource;
-import org.apache.tapestry.ioc.services.TypeCoercer;
-
 import java.lang.annotation.Documented;
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.PARAMETER;
@@ -25,16 +22,16 @@
 import java.lang.annotation.Target;
 
 /**
- * Used in conjunction with {@link Inject} to inject a literal value, rather than a service. Symbols
- * in the value are expanded and the resulting string is coerced to the desired type. For IoC, this
- * annotation is only applied to parameters (on service builder methods, and on service
- * constructors); for components, it may also be applied to field.
+ * Used in conjunction with {@link org.apache.tapestry.ioc.annotations.Inject} to inject a literal value, rather than a
+ * service. Symbols in the value are expanded and the resulting string is coerced to the desired type. For IoC, this
+ * annotation is only applied to parameters (on service builder methods, and on service constructors); for components,
+ * it may also be applied to field.
  *
- * @see SymbolSource
- * @see TypeCoercer
+ * @see org.apache.tapestry.ioc.services.SymbolSource
+ * @see org.apache.tapestry.ioc.services.TypeCoercer
  */
 @Target(
-        {PARAMETER, FIELD})
+        { PARAMETER, FIELD })
 @Retention(RUNTIME)
 @Documented
 public @interface Value