You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/07/18 13:09:15 UTC
[38/50] [abbrv] tinkerpop git commit: DotNet: Generate ValueMap()
method with 2 type parameters
DotNet: Generate ValueMap() method with 2 type parameters
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c074ea05
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c074ea05
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c074ea05
Branch: refs/heads/master
Commit: c074ea05bae2c0b94d0c8c0e2a2790c1779d1d0e
Parents: 6115cf4
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Jul 12 17:11:42 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jul 14 11:57:50 2017 +0200
----------------------------------------------------------------------
gremlin-dotnet/pom.xml | 8 +++++++-
.../src/Gremlin.Net/Process/Traversal/GraphTraversal.cs | 8 ++++----
gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs | 4 ++--
.../Traversal/DriverRemoteConnection/GraphTraversalTests.cs | 4 ++--
4 files changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c074ea05/gremlin-dotnet/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/pom.xml b/gremlin-dotnet/pom.xml
index 2ba30ec..319bb9c 100644
--- a/gremlin-dotnet/pom.xml
+++ b/gremlin-dotnet/pom.xml
@@ -108,7 +108,8 @@ def methodsWithSpecificTypes = ["constant": useE2,
"sum": useE2,
"tail": useE2,
"tree": ["object"],
- "unfold": useE2]
+ "unfold": useE2,
+ "valueMap": ["IDictionary<TKey, TValue>", "TKey, TValue"],]
def getCSharpGenericTypeParam = { typeName ->
def tParam = ""
@@ -183,6 +184,11 @@ def binding = ["pmethods": P.class.getMethods().
def t1 = toCSharpType(typeNames[0])
def t2 = toCSharpType(typeNames[1])
def tParam = getCSharpGenericTypeParam(t2)
+ def specificTypes = methodsWithSpecificTypes.get(javaMethod.name)
+ if (specificTypes) {
+ t2 = specificTypes[0]
+ tParam = specificTypes.size() > 1 ? "<" + specificTypes[1] + ">" : ""
+ }
return ["methodName": javaMethod.name, "t1":t1, "t2":t2, "tParam":tParam]
},
"anonStepMethods": __.class.getMethods().
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c074ea05/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index 8f5b48c..8f22888 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -893,10 +893,10 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the tree step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E > Tree (params object[] args)
+ public GraphTraversal< S , object > Tree (params object[] args)
{
Bytecode.AddStep("tree", args);
- return Wrap< S , E >(this);
+ return Wrap< S , object >(this);
}
/// <summary>
@@ -938,10 +938,10 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the valueMap step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , IDictionary<object, E2> > ValueMap<E2> (params object[] args)
+ public GraphTraversal< S , IDictionary<TKey, TValue> > ValueMap<TKey, TValue> (params object[] args)
{
Bytecode.AddStep("valueMap", args);
- return Wrap< S , IDictionary<object, E2> >(this);
+ return Wrap< S , IDictionary<TKey, TValue> >(this);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c074ea05/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
index e0e6e42..c1aed20 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
@@ -763,9 +763,9 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the valueMap step to that traversal.
/// </summary>
- public static GraphTraversal<object, IDictionary<object, E2>> ValueMap<E2>(params object[] args)
+ public static GraphTraversal<object, IDictionary<TKey, TValue>> ValueMap<TKey, TValue>(params object[] args)
{
- return new GraphTraversal<object, object>().ValueMap<E2>(args);
+ return new GraphTraversal<object, object>().ValueMap<TKey, TValue>(args);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c074ea05/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
index 24c75b0..11190ce 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
@@ -102,9 +102,9 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
var connection = _connectionFactory.CreateRemoteConnection();
var g = graph.Traversal().WithRemote(connection);
- var receivedValueMap = g.V().Has("name", "marko").ValueMap<object>().Next();
+ var receivedValueMap = g.V().Has("name", "marko").ValueMap<string, object>().Next();
- var expectedValueMap = new Dictionary<object, object>
+ var expectedValueMap = new Dictionary<string, object>
{
{"age", new List<object> {29}},
{"name", new List<object> {"marko"}}