tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [13/50] [abbrv] tinkerpop git commit: TINKERPOP-786 Used templating language instead of string concat
Date Fri, 26 May 2017 13:00:27 GMT
TINKERPOP-786 Used templating language instead of string concat


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2d574fbd
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2d574fbd
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2d574fbd

Branch: refs/heads/TINKERPOP-1552
Commit: 2d574fbddc8aefd671880427c421b610da0f3b4d
Parents: a98471c
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Thu May 4 10:28:29 2017 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Tue May 16 11:01:50 2017 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/dsl/GremlinDslProcessor.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d574fbd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/GremlinDslProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/GremlinDslProcessor.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/GremlinDslProcessor.java
index f8a3266..e246765 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/GremlinDslProcessor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/GremlinDslProcessor.java
@@ -154,7 +154,7 @@ public class GremlinDslProcessor extends AbstractProcessor {
 
                 boolean added = false;
                 final List<? extends VariableElement> parameters = templateMethod.getParameters();
-                String body = "return new " + ctx.defaultTraversalClassName + "(clone, super."
+ elementOfGraphTraversalSource.getSimpleName().toString() + "(";
+                String body = "return new $T (clone, super.$L(";
                 for (VariableElement param : parameters) {
                     methodToAdd.addParameter(ParameterSpec.get(param));
 
@@ -170,7 +170,7 @@ public class GremlinDslProcessor extends AbstractProcessor {
 
                 body = body + ").asAdmin())";
                 methodToAdd.addStatement("$T clone = this.clone()", ctx.traversalSourceClassName)
-                        .addStatement(body)
+                        .addStatement(body, ctx.defaultTraversalClassName, elementOfGraphTraversalSource.getSimpleName())
                         .returns(getReturnTypeDefinition(ctx.traversalClassName, templateMethod));
 
                 traversalSourceClass.addMethod(methodToAdd.build());
@@ -344,7 +344,7 @@ public class GremlinDslProcessor extends AbstractProcessor {
         boolean added = false;
         final List<? extends VariableElement> parameters = templateMethod.getParameters();
         final String parentCall = parent.isEmpty() ? "" : parent + ".";
-        String body = "return (" + returnClazz.simpleName() + ") " + parentCall + "super."
+ methodName + "(";
+        String body = "return ($T) " + parentCall + "super.$L(";
         for (VariableElement param : parameters) {
             methodToAdd.addParameter(ParameterSpec.get(param));
 
@@ -359,7 +359,7 @@ public class GremlinDslProcessor extends AbstractProcessor {
         if (added) body = body.substring(0, body.length() - 1);
 
         body = body + ")";
-        methodToAdd.addStatement(body);
+        methodToAdd.addStatement(body, returnClazz, methodName);
 
         return Optional.of(methodToAdd.build());
     }


Mime
View raw message