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 2018/03/23 17:51:41 UTC

[2/4] tinkerpop git commit: TINKERPOP-1866 Avoid using reflection for T deserialization

TINKERPOP-1866 Avoid using reflection for T deserialization

Expose GetByValue() static method on EnumWrapper implementation to
try to expose the same functionality as if it were an enum.

Use the GetByValue() to deserialize a T instance.


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

Branch: refs/heads/master
Commit: 69eb333af04357238b2fa5ce16c80a5f10cca39e
Parents: 4016c80
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Mar 23 12:07:25 2018 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Mar 23 12:07:25 2018 +0100

----------------------------------------------------------------------
 gremlin-dotnet/glv/Enum.template                | 37 +++++++++--
 gremlin-dotnet/glv/generate.groovy              | 15 +----
 .../Gremlin.Net/Process/Traversal/Barrier.cs    | 27 +++++++-
 .../Process/Traversal/Cardinality.cs            | 35 ++++++++--
 .../src/Gremlin.Net/Process/Traversal/Column.cs | 31 +++++++--
 .../Gremlin.Net/Process/Traversal/Direction.cs  | 35 ++++++++--
 .../Process/Traversal/GraphSONVersion.cs        | 35 ++++++++--
 .../Process/Traversal/GryoVersion.cs            | 31 +++++++--
 .../Gremlin.Net/Process/Traversal/Operator.cs   | 67 ++++++++++++++++----
 .../src/Gremlin.Net/Process/Traversal/Order.cs  | 35 ++++++++--
 .../src/Gremlin.Net/Process/Traversal/Pick.cs   | 31 +++++++--
 .../src/Gremlin.Net/Process/Traversal/Pop.cs    | 39 ++++++++++--
 .../src/Gremlin.Net/Process/Traversal/Scope.cs  | 31 +++++++--
 .../src/Gremlin.Net/Process/Traversal/T.cs      | 39 ++++++++++--
 .../Structure/IO/GraphSON/TDeserializer.cs      |  8 +--
 .../Gherkin/CommonSteps.cs                      |  3 +-
 16 files changed, 409 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/glv/Enum.template
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/Enum.template b/gremlin-dotnet/glv/Enum.template
index 1f11076..e785cd0 100644
--- a/gremlin-dotnet/glv/Enum.template
+++ b/gremlin-dotnet/glv/Enum.template
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,11 +33,37 @@ namespace Gremlin.Net.Process.Traversal
     {
         private <%= enumClass.simpleName %>(string enumValue)
             : base("<%= enumClass.simpleName %>", enumValue)
-        {            
+        {
+        }
+<%
+    def toCSharpName = { enumClass, itemName ->
+        if (enumClass.equals(directionClass)) {
+            itemName = itemName.toLowerCase()
+        }
+
+        return itemName.substring(0, 1).toUpperCase() + itemName.substring(1)
+    }
+    constants.each { value -> %>
+        public static ${enumClass.simpleName} ${toCSharpName(enumClass, value.name())} => new ${enumClass.simpleName}("${value.name()}");
+<%  }%>
+        private static readonly IDictionary<string, <%= enumClass.simpleName %>> Properties = new Dictionary<string, <%= enumClass.simpleName %>>
+        {<%  constants.each { value -> %>
+            { "${value.name()}", ${toCSharpName(enumClass, value.name())} },<%  }%>
+        };
+
+        /// <summary>
+        /// Gets the <%= enumClass.simpleName %> enumeration by value.
+        /// </summary>
+        public static <%= enumClass.simpleName %> GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException(\$"No matching <%= enumClass.simpleName%> for value '{value}'");
+            }
+            return property;
         }
-<% constants.each { constant -> %> 
-        <%= constant %><%}%>
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy
index bf7f03b..91f9b94 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -321,14 +321,6 @@ def pTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/P.template
 def pFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/P.cs")
 pFile.newWriter().withWriter{ it << pTemplate }
 
-// Process enums
-def toCSharpName = { enumClass, itemName ->
-    if (enumClass.equals(Direction.class)) {
-        itemName = itemName.toLowerCase()
-    }
-
-    return itemName.substring(0, 1).toUpperCase() + itemName.substring(1)
-}
 
 def createEnum = { enumClass ->
     def b = ["enumClass": enumClass,
@@ -341,11 +333,8 @@ def createEnum = { enumClass ->
                         return toCSharpTypeMap[typeName]
                     }.join(", "),
              "constants": enumClass.getEnumConstants().
-                    sort { a, b -> a.name() <=> b.name() }.
-                    collect { value ->
-                        def csharpName = toCSharpName(enumClass, value.name())
-                        return "public static ${enumClass.simpleName} ${csharpName} => new ${enumClass.simpleName}(\"${value.name()}\");"
-                    }]
+                    sort { a, b -> a.name() <=> b.name() },
+             "directionClass": Direction.class ]
 
     def enumTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/Enum.template")).make(b)
     def enumFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/" + enumClass.getSimpleName() + ".cs")

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs
index df6d349..0f86f32 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,11 +33,29 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Barrier(string enumValue)
             : base("Barrier", enumValue)
-        {            
+        {
         }
- 
+
         public static Barrier NormSack => new Barrier("normSack");
+
+        private static readonly IDictionary<string, Barrier> Properties = new Dictionary<string, Barrier>
+        {
+            { "normSack", NormSack },
+        };
+
+        /// <summary>
+        /// Gets the Barrier enumeration by value.
+        /// </summary>
+        public static Barrier GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Barrier for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs
index d2cbcf2..caced7d 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,13 +33,35 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Cardinality(string enumValue)
             : base("Cardinality", enumValue)
-        {            
+        {
         }
- 
-        public static Cardinality List => new Cardinality("list"); 
-        public static Cardinality Set => new Cardinality("set"); 
+
+        public static Cardinality List => new Cardinality("list");
+
+        public static Cardinality Set => new Cardinality("set");
+
         public static Cardinality Single => new Cardinality("single");
+
+        private static readonly IDictionary<string, Cardinality> Properties = new Dictionary<string, Cardinality>
+        {
+            { "list", List },
+            { "set", Set },
+            { "single", Single },
+        };
+
+        /// <summary>
+        /// Gets the Cardinality enumeration by value.
+        /// </summary>
+        public static Cardinality GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Cardinality for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs
index 9e0451e..cacf886 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,12 +33,32 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Column(string enumValue)
             : base("Column", enumValue)
-        {            
+        {
         }
- 
-        public static Column Keys => new Column("keys"); 
+
+        public static Column Keys => new Column("keys");
+
         public static Column Values => new Column("values");
+
+        private static readonly IDictionary<string, Column> Properties = new Dictionary<string, Column>
+        {
+            { "keys", Keys },
+            { "values", Values },
+        };
+
+        /// <summary>
+        /// Gets the Column enumeration by value.
+        /// </summary>
+        public static Column GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Column for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs
index 5a93f0a..92d9416 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,13 +33,35 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Direction(string enumValue)
             : base("Direction", enumValue)
-        {            
+        {
         }
- 
-        public static Direction Both => new Direction("BOTH"); 
-        public static Direction In => new Direction("IN"); 
+
+        public static Direction Both => new Direction("BOTH");
+
+        public static Direction In => new Direction("IN");
+
         public static Direction Out => new Direction("OUT");
+
+        private static readonly IDictionary<string, Direction> Properties = new Dictionary<string, Direction>
+        {
+            { "BOTH", Both },
+            { "IN", In },
+            { "OUT", Out },
+        };
+
+        /// <summary>
+        /// Gets the Direction enumeration by value.
+        /// </summary>
+        public static Direction GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Direction for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphSONVersion.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphSONVersion.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphSONVersion.cs
index e55be6b..366c48c 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphSONVersion.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphSONVersion.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,13 +33,35 @@ namespace Gremlin.Net.Process.Traversal
     {
         private GraphSONVersion(string enumValue)
             : base("GraphSONVersion", enumValue)
-        {            
+        {
         }
- 
-        public static GraphSONVersion V1_0 => new GraphSONVersion("V1_0"); 
-        public static GraphSONVersion V2_0 => new GraphSONVersion("V2_0"); 
+
+        public static GraphSONVersion V1_0 => new GraphSONVersion("V1_0");
+
+        public static GraphSONVersion V2_0 => new GraphSONVersion("V2_0");
+
         public static GraphSONVersion V3_0 => new GraphSONVersion("V3_0");
+
+        private static readonly IDictionary<string, GraphSONVersion> Properties = new Dictionary<string, GraphSONVersion>
+        {
+            { "V1_0", V1_0 },
+            { "V2_0", V2_0 },
+            { "V3_0", V3_0 },
+        };
+
+        /// <summary>
+        /// Gets the GraphSONVersion enumeration by value.
+        /// </summary>
+        public static GraphSONVersion GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching GraphSONVersion for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GryoVersion.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GryoVersion.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GryoVersion.cs
index 93fc369..01d2a99 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GryoVersion.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GryoVersion.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,12 +33,32 @@ namespace Gremlin.Net.Process.Traversal
     {
         private GryoVersion(string enumValue)
             : base("GryoVersion", enumValue)
-        {            
+        {
         }
- 
-        public static GryoVersion V1_0 => new GryoVersion("V1_0"); 
+
+        public static GryoVersion V1_0 => new GryoVersion("V1_0");
+
         public static GryoVersion V3_0 => new GryoVersion("V3_0");
+
+        private static readonly IDictionary<string, GryoVersion> Properties = new Dictionary<string, GryoVersion>
+        {
+            { "V1_0", V1_0 },
+            { "V3_0", V3_0 },
+        };
+
+        /// <summary>
+        /// Gets the GryoVersion enumeration by value.
+        /// </summary>
+        public static GryoVersion GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching GryoVersion for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs
index 8f0c9b3..8b87e40 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,21 +33,59 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Operator(string enumValue)
             : base("Operator", enumValue)
-        {            
+        {
         }
- 
-        public static Operator AddAll => new Operator("addAll"); 
-        public static Operator And => new Operator("and"); 
-        public static Operator Assign => new Operator("assign"); 
-        public static Operator Div => new Operator("div"); 
-        public static Operator Max => new Operator("max"); 
-        public static Operator Min => new Operator("min"); 
-        public static Operator Minus => new Operator("minus"); 
-        public static Operator Mult => new Operator("mult"); 
-        public static Operator Or => new Operator("or"); 
-        public static Operator Sum => new Operator("sum"); 
+
+        public static Operator AddAll => new Operator("addAll");
+
+        public static Operator And => new Operator("and");
+
+        public static Operator Assign => new Operator("assign");
+
+        public static Operator Div => new Operator("div");
+
+        public static Operator Max => new Operator("max");
+
+        public static Operator Min => new Operator("min");
+
+        public static Operator Minus => new Operator("minus");
+
+        public static Operator Mult => new Operator("mult");
+
+        public static Operator Or => new Operator("or");
+
+        public static Operator Sum => new Operator("sum");
+
         public static Operator SumLong => new Operator("sumLong");
+
+        private static readonly IDictionary<string, Operator> Properties = new Dictionary<string, Operator>
+        {
+            { "addAll", AddAll },
+            { "and", And },
+            { "assign", Assign },
+            { "div", Div },
+            { "max", Max },
+            { "min", Min },
+            { "minus", Minus },
+            { "mult", Mult },
+            { "or", Or },
+            { "sum", Sum },
+            { "sumLong", SumLong },
+        };
+
+        /// <summary>
+        /// Gets the Operator enumeration by value.
+        /// </summary>
+        public static Operator GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Operator for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs
index c6a1817..2430114 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,13 +33,35 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Order(string enumValue)
             : base("Order", enumValue)
-        {            
+        {
         }
- 
-        public static Order Decr => new Order("decr"); 
-        public static Order Incr => new Order("incr"); 
+
+        public static Order Decr => new Order("decr");
+
+        public static Order Incr => new Order("incr");
+
         public static Order Shuffle => new Order("shuffle");
+
+        private static readonly IDictionary<string, Order> Properties = new Dictionary<string, Order>
+        {
+            { "decr", Decr },
+            { "incr", Incr },
+            { "shuffle", Shuffle },
+        };
+
+        /// <summary>
+        /// Gets the Order enumeration by value.
+        /// </summary>
+        public static Order GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Order for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs
index d4132ea..b7dd8c2 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,12 +33,32 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Pick(string enumValue)
             : base("Pick", enumValue)
-        {            
+        {
         }
- 
-        public static Pick Any => new Pick("any"); 
+
+        public static Pick Any => new Pick("any");
+
         public static Pick None => new Pick("none");
+
+        private static readonly IDictionary<string, Pick> Properties = new Dictionary<string, Pick>
+        {
+            { "any", Any },
+            { "none", None },
+        };
+
+        /// <summary>
+        /// Gets the Pick enumeration by value.
+        /// </summary>
+        public static Pick GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Pick for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs
index d1915fc..1210f5c 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,14 +33,38 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Pop(string enumValue)
             : base("Pop", enumValue)
-        {            
+        {
         }
- 
-        public static Pop All => new Pop("all"); 
-        public static Pop First => new Pop("first"); 
-        public static Pop Last => new Pop("last"); 
+
+        public static Pop All => new Pop("all");
+
+        public static Pop First => new Pop("first");
+
+        public static Pop Last => new Pop("last");
+
         public static Pop Mixed => new Pop("mixed");
+
+        private static readonly IDictionary<string, Pop> Properties = new Dictionary<string, Pop>
+        {
+            { "all", All },
+            { "first", First },
+            { "last", Last },
+            { "mixed", Mixed },
+        };
+
+        /// <summary>
+        /// Gets the Pop enumeration by value.
+        /// </summary>
+        public static Pop GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Pop for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs
index ee67c39..2df6a95 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,12 +33,32 @@ namespace Gremlin.Net.Process.Traversal
     {
         private Scope(string enumValue)
             : base("Scope", enumValue)
-        {            
+        {
         }
- 
-        public static Scope Global => new Scope("global"); 
+
+        public static Scope Global => new Scope("global");
+
         public static Scope Local => new Scope("local");
+
+        private static readonly IDictionary<string, Scope> Properties = new Dictionary<string, Scope>
+        {
+            { "global", Global },
+            { "local", Local },
+        };
+
+        /// <summary>
+        /// Gets the Scope enumeration by value.
+        /// </summary>
+        public static Scope GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching Scope for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs
index bae1314..80ca0ec 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs
@@ -22,6 +22,9 @@
 #endregion
 
 // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections.Generic;
+
 namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
@@ -30,14 +33,38 @@ namespace Gremlin.Net.Process.Traversal
     {
         private T(string enumValue)
             : base("T", enumValue)
-        {            
+        {
         }
- 
-        public static T Id => new T("id"); 
-        public static T Key => new T("key"); 
-        public static T Label => new T("label"); 
+
+        public static T Id => new T("id");
+
+        public static T Key => new T("key");
+
+        public static T Label => new T("label");
+
         public static T Value => new T("value");
+
+        private static readonly IDictionary<string, T> Properties = new Dictionary<string, T>
+        {
+            { "id", Id },
+            { "key", Key },
+            { "label", Label },
+            { "value", Value },
+        };
+
+        /// <summary>
+        /// Gets the T enumeration by value.
+        /// </summary>
+        public static T GetByValue(string value)
+        {
+            if (!Properties.TryGetValue(value, out var property))
+            {
+                throw new ArgumentException($"No matching T for value '{value}'");
+            }
+            return property;
+        }
     }
-    
+
+
 #pragma warning restore 1591
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TDeserializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TDeserializer.cs
index e79783c..a3d972f 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TDeserializer.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TDeserializer.cs
@@ -21,9 +21,6 @@
 
 #endregion
 
-using System;
-using System.Linq;
-using System.Reflection;
 using Gremlin.Net.Process.Traversal;
 using Newtonsoft.Json.Linq;
 
@@ -33,10 +30,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
     {
         public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
         {
-            var tValue = graphsonObject.ToString();
-            return typeof(T).GetProperties()
-                .First(p => string.Equals(p.Name, tValue, StringComparison.OrdinalIgnoreCase))
-                .GetValue(null);
+            return T.GetByValue(graphsonObject.ToString());
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69eb333a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 31948f4..6e21bd2 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -240,8 +240,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 
         private static object ToT(string enumName, string graphName)
         {
-            return typeof(T).GetProperties()
-                .First(p => string.Equals(p.Name, enumName, StringComparison.OrdinalIgnoreCase)).GetValue(null);
+            return T.GetByValue(enumName);
         }
 
         private static object ToNumber(string stringNumber, string graphName)