tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r1097991 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
Date Fri, 29 Apr 2011 22:55:17 GMT
Author: hlship
Date: Fri Apr 29 22:55:16 2011
New Revision: 1097991

URL: http://svn.apache.org/viewvc?rev=1097991&view=rev
Log:
TAP5-853: Reimplement replaceAccess()

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

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java?rev=1097991&r1=1097990&r2=1097991&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
Fri Apr 29 22:55:16 2011
@@ -24,7 +24,6 @@ import org.apache.tapestry5.func.Predica
 import org.apache.tapestry5.internal.plastic.PlasticInternalUtils;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.ioc.services.FieldValueConduit;
-import org.apache.tapestry5.ioc.services.MethodSignature;
 import org.apache.tapestry5.model.MutableComponentModel;
 import org.apache.tapestry5.plastic.ComputedValue;
 import org.apache.tapestry5.plastic.FieldConduit;
@@ -84,6 +83,22 @@ public class BridgeClassTransformation i
         };
     }
 
+    private static FieldConduit<?> toFieldConduit(final FieldValueConduit fieldValueConduit)
+    {
+        return new FieldConduit<Object>()
+        {
+            public Object get(InstanceContext context)
+            {
+                return fieldValueConduit.get();
+            }
+
+            public void set(InstanceContext context, Object newValue)
+            {
+                fieldValueConduit.set(newValue);
+            }
+        };
+    }
+
     private static TransformMethodSignature toMethodSignature(MethodDescription description)
     {
         return new TransformMethodSignature(description.modifiers, description.returnType,
description.methodName,
@@ -131,7 +146,17 @@ public class BridgeClassTransformation i
 
         public void replaceAccess(final ComponentValueProvider<FieldValueConduit> conduitProvider)
         {
-            throw new IllegalStateException("replaceAccess() not yet implemented.");
+            plasticField.setComputedConduit(new ComputedValue<FieldConduit<?>>()
+            {
+                public FieldConduit<?> get(InstanceContext context)
+                {
+                    ComponentResources resources = context.get(ComponentResources.class);
+
+                    FieldValueConduit fieldValueConduit = conduitProvider.get(resources);
+
+                    return toFieldConduit(fieldValueConduit);
+                }
+            });
         }
 
         public void replaceAccess(TransformField conduitField)



Mime
View raw message