tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r1091979 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
Date Thu, 14 Apr 2011 00:33:08 GMT
Author: hlship
Date: Thu Apr 14 00:33:08 2011
New Revision: 1091979

URL: http://svn.apache.org/viewvc?rev=1091979&view=rev
Log:
TAP5-853: Eliminate the need for seperate getRoot() and navigate() methods in single term
property expressions

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

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java?rev=1091979&r1=1091978&r2=1091979&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
Thu Apr 14 00:33:08 2011
@@ -383,28 +383,32 @@ public class PropertyConduitSourceImpl i
                 node = node.getChild(1);
             }
 
-            // TODO: Optimization -- navigate method not needed (i.e., same as getRoot) for
simple
-            // expressions.
-
             Class activeClass = GenericsUtils.asClass(activeType);
 
-            navMethod = plasticClass.introducePrivateMethod(PlasticUtils.toTypeName(activeClass),
"navigate",
-                    SINGLE_OBJECT_ARGUMENT, null);
-
-            navMethod.changeImplementation(new InstructionBuilderCallback()
+            if (callbacks.isEmpty())
             {
-                public void doBuild(InstructionBuilder builder)
-                {
-                    builder.loadThis().loadArgument(0).invokeVirtual(getRootMethod);
+                navMethod = getRootMethod;
+            }
+            else
+            {
+                navMethod = plasticClass.introducePrivateMethod(PlasticUtils.toTypeName(activeClass),
"navigate",
+                        SINGLE_OBJECT_ARGUMENT, null);
 
-                    for (InstructionBuilderCallback callback : callbacks)
+                navMethod.changeImplementation(new InstructionBuilderCallback()
+                {
+                    public void doBuild(InstructionBuilder builder)
                     {
-                        callback.doBuild(builder);
-                    }
+                        builder.loadThis().loadArgument(0).invokeVirtual(getRootMethod);
 
-                    builder.returnResult();
-                }
-            });
+                        for (InstructionBuilderCallback callback : callbacks)
+                        {
+                            callback.doBuild(builder);
+                        }
+
+                        builder.returnResult();
+                    }
+                });
+            }
 
             implementAccessors(activeType, node);
         }



Mime
View raw message