tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r1149382 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5: internal/transform/RetainWorker.java services/TapestryModule.java
Date Thu, 21 Jul 2011 21:53:11 GMT
Author: hlship
Date: Thu Jul 21 21:53:10 2011
New Revision: 1149382

URL: http://svn.apache.org/viewvc?rev=1149382&view=rev
Log:
TAP5-1508: Convert RetainWorker from CCTW to CCTW2

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/RetainWorker.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/RetainWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/RetainWorker.java?rev=1149382&r1=1149381&r2=1149382&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/RetainWorker.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/RetainWorker.java
Thu Jul 21 21:53:10 2011
@@ -14,34 +14,29 @@
 
 package org.apache.tapestry5.internal.transform;
 
-import java.util.List;
-
 import org.apache.tapestry5.annotations.Retain;
 import org.apache.tapestry5.model.MutableComponentModel;
-import org.apache.tapestry5.services.ClassTransformation;
-import org.apache.tapestry5.services.ComponentClassTransformWorker;
-import org.apache.tapestry5.services.TransformField;
+import org.apache.tapestry5.plastic.PlasticClass;
+import org.apache.tapestry5.plastic.PlasticField;
+import org.apache.tapestry5.services.transform.ComponentClassTransformWorker2;
+import org.apache.tapestry5.services.transform.TransformationSupport;
 
 /**
  * Identifies fields with the {@link org.apache.tapestry5.annotations.Retain} annotation,
and "claims" them so that no
  * special work will occur on them. Retain has been deprecated in Tapestry 5.2 and will likely
be removed in the future.
  */
-public final class RetainWorker implements ComponentClassTransformWorker
+public final class RetainWorker implements ComponentClassTransformWorker2
 {
     /**
-     * Claims each field with the {@link org.apache.tapestry5.annotations.Retain} annotation,
claiming it using the
-     * annotation as the tag.
+     * Claims each field with the {@link org.apache.tapestry5.annotations.Retain}  , claiming
it using the
+     * annotation class (not the annotation instance, to avoid
+     * instantiating the annotation) as the tag.
      */
-    @SuppressWarnings("deprecation")
-    public void transform(ClassTransformation transformation, MutableComponentModel model)
+    public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel
model)
     {
-        List<TransformField> fields = transformation.matchFieldsWithAnnotation(Retain.class);
-
-        for (TransformField field : fields)
+        for (PlasticField field : plasticClass.getFieldsWithAnnotation(Retain.class))
         {
-            Retain annotation = field.getAnnotation(Retain.class);
-
-            field.claim(annotation);
+            field.claim(Retain.class);
         }
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1149382&r1=1149381&r2=1149382&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
Thu Jul 21 21:53:10 2011
@@ -511,6 +511,8 @@ public final class TapestryModule
      * <dd>Checks for the annotation</dd>
      * <dt>RenderPhase</dt>
      * <dd>Link in render phase methods</dd>
+     * <dt>Retain</dt>
+     * <dd>Allows fields to retain their values between requests</dd>
      * <dt>Meta</dt>
      * <dd>Checks for meta data annotations and adds it to the component model</dd>
      * </dl>
@@ -558,6 +560,9 @@ public final class TapestryModule
 
         configuration.add("Meta", metaWorker);
 
+        configuration.add("Retain", new RetainWorker());
+
+
         // This one is always last. Any additional private fields that aren't
         // annotated will
         // be converted to clear out at the end of the request.
@@ -568,8 +573,6 @@ public final class TapestryModule
     /**
      * Adds a number of standard component class transform workers:
      * <dl>
-     * <dt>Retain</dt>
-     * <dd>Allows fields to retain their values between requests</dd>
      * <dt>Persist</dt>
      * <dd>Allows fields to store their their value persistently between requests</dd>
      * <dt>Component</dt>
@@ -626,7 +629,6 @@ public final class TapestryModule
         add(configuration, PageAttached.class, TransformConstants.CONTAINING_PAGE_DID_ATTACH_SIGNATURE,
"pageAttached");
         add(configuration, PageDetached.class, TransformConstants.CONTAINING_PAGE_DID_DETACH_SIGNATURE,
"pageDetached");
 
-        configuration.add("Retain", new RetainWorker());
         configuration.addInstance("Persist", PersistWorker.class);
 
         configuration.addInstance("DiscardAfter", DiscardAfterWorker.class);



Mime
View raw message