TINKERPOP-1874 keep P.within and P.without using collection

GraphSON deserialization of P.within and P.without expects a single collection 
regardless of the number of values, so even a single argument should serialize 
to a list.


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

Branch: refs/heads/TINKERPOP-1447
Commit: 822b33174c87a2a918b3fc9df421585a57ef3345
Parents: 261b93b
Author: Stephen Mallette <[email protected]>
Authored: Fri Jan 19 08:18:25 2018 -0500
Committer: Stephen Mallette <[email protected]>
Committed: Fri Jan 19 08:18:25 2018 -0500

----------------------------------------------------------------------
 gremlin-dotnet/glv/P.template                         | 7 ++++++-
 gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs | 6 ++----
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/822b3317/gremlin-dotnet/glv/P.template
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/P.template b/gremlin-dotnet/glv/P.template
index f187cbb..f337127 100644
--- a/gremlin-dotnet/glv/P.template
+++ b/gremlin-dotnet/glv/P.template
@@ -32,12 +32,17 @@ namespace Gremlin.Net.Process.Traversal
     /// </summary>
     public class P
     {
-<% pmethods.each { method -> %>
+<% pmethods.findAll{ !(it in ["within", "without"]) }.each { method -> %>
         public static TraversalPredicate <%= toCSharpMethodName.call(method) 
%>(params object[] args)
         {
             var value = args.Length == 1 ? args[0] : args;
             return new TraversalPredicate("<%= method %>", value);
         }
+<% } %><% pmethods.findAll{ it in ["within", "without"] }.each { method -> %>
+        public static TraversalPredicate <%= toCSharpMethodName.call(method) 
%>(params object[] args)
+        {
+            return new TraversalPredicate("<%= method %>", args);
+        }
 <% } %>
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/822b3317/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs 
b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs
index 89bdc29..0a7809f 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs
@@ -101,14 +101,12 @@ namespace Gremlin.Net.Process.Traversal
 
         public static TraversalPredicate Within(params object[] args)
         {
-            var value = args.Length == 1 ? args[0] : args;
-            return new TraversalPredicate("within", value);
+            return new TraversalPredicate("within", args);
         }
 
         public static TraversalPredicate Without(params object[] args)
         {
-            var value = args.Length == 1 ? args[0] : args;
-            return new TraversalPredicate("without", value);
+            return new TraversalPredicate("without", args);
         }
 
     }

Reply via email to