TINKERPOP-1901 Transformed Gremlin.Net enums into classes

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

Branch: refs/heads/tp33
Commit: dcf3da3917a9626d432ef26089bb05c6a15158ed
Parents: ab66ed3
Author: Florian Hockmann <f...@florian-hockmann.de>
Authored: Sat Mar 10 19:17:15 2018 +0100
Committer: Florian Hockmann <f...@florian-hockmann.de>
Committed: Sat Mar 10 19:17:15 2018 +0100

----------------------------------------------------------------------
 docs/src/reference/gremlin-variants.asciidoc    |  2 +-
 gremlin-dotnet/glv/Enum.template                |  7 +-
 gremlin-dotnet/glv/generate.groovy              | 21 +----
 .../Gremlin.Net/Process/Traversal/Barrier.cs    |  9 +-
 .../Process/Traversal/Cardinality.cs            | 13 ++-
 .../src/Gremlin.Net/Process/Traversal/Column.cs | 11 ++-
 .../Gremlin.Net/Process/Traversal/Direction.cs  | 13 ++-
 .../Process/Traversal/EnumWrapper.cs            | 52 +++++++++++
 .../Process/Traversal/GraphSONVersion.cs        | 11 ++-
 .../Process/Traversal/GryoVersion.cs            |  9 +-
 .../Process/Traversal/NamingConversions.cs      | 91 --------------------
 .../Gremlin.Net/Process/Traversal/Operator.cs   | 29 ++++---
 .../src/Gremlin.Net/Process/Traversal/Order.cs  | 21 +++--
 .../src/Gremlin.Net/Process/Traversal/Pick.cs   | 11 ++-
 .../src/Gremlin.Net/Process/Traversal/Pop.cs    | 13 ++-
 .../src/Gremlin.Net/Process/Traversal/Scope.cs  | 11 ++-
 .../src/Gremlin.Net/Process/Traversal/T.cs      | 15 ++--
 .../Structure/IO/GraphSON/EnumSerializer.cs     |  5 +-
 .../Structure/IO/GraphSON/GraphSONWriter.cs     |  2 +-
 .../TraversalEnumParameter.cs                   |  5 +-
 20 files changed, 181 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index f06fe02..ace8119 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -362,7 +362,7 @@ terminal/action methods off of `ITraversal`.
 
 === Static Enums and Methods
 
-Gremlin has various tokens (e.g. `T`, `P`, `Order`, `Operator`, etc.) that are 
represented in Gremlin.Net as Enums.
+Gremlin has various tokens (e.g. `T`, `P`, `Order`, `Operator`, etc.) that are 
represented in Gremlin.Net as classes.
 
 These can be used analogously to how they are used in Gremlin-Java.
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/gremlin-dotnet/glv/Enum.template
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/Enum.template b/gremlin-dotnet/glv/Enum.template
index 1fddab1..fd09312 100644
--- a/gremlin-dotnet/glv/Enum.template
+++ b/gremlin-dotnet/glv/Enum.template
@@ -26,8 +26,13 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum <%= enumClass.simpleName %>
+    public class <%= enumClass.simpleName %> : EnumWrapper
     {
+        private <%= enumClass.simpleName %>(string enumValue)
+            : base("<%= enumClass.simpleName %>", enumValue)
+        {            
+        }
+
         <%= constants %>
     }
     

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy 
b/gremlin-dotnet/glv/generate.groovy
index 12cfa88..7894793 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -339,36 +339,23 @@ def toCSharpName = { enumClass, itemName ->
     return itemName.substring(0, 1).toUpperCase() + itemName.substring(1)
 }
 
-def createEnum = { enumClass, csharpToJava ->
+def createEnum = { enumClass ->
     def b = ["enumClass": enumClass,
              "constants": enumClass.getEnumConstants().
                     sort { a, b -> a.name() <=> b.name() }.
                     collect { value ->
                         def csharpName = toCSharpName(enumClass, value.name())
-                        csharpToJava.put(enumClass.simpleName + "." + 
csharpName, value.name())
-                        return csharpName
-                    }.join(",\n\t\t")]
+                        return "public static ${enumClass.simpleName} 
${csharpName} => new ${enumClass.simpleName}(\"${value.name()}\");"
+                    }.join("\n\t\t")]
 
     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")
     enumFile.newWriter().withWriter{ it << enumTemplate }
 }
 
-def enumCSharpToJavaNames = [:]
 CoreImports.getClassImports().findAll { Enum.class.isAssignableFrom(it) }.
         sort { a, b -> a.getSimpleName() <=> b.getSimpleName() }.
-        each { createEnum(it, enumCSharpToJavaNames) }
-
-def lastIndex = (enumCSharpToJavaNames.size() - 1);
-def body = new StringBuilder()
-enumCSharpToJavaNames.eachWithIndex{ node, i ->
-    body.append("""{"$node.key", "$node.value"}""")
-    body.append(i == lastIndex ? "\n" : ",\n            ")
-}
-
-def namingConversionsTemplate = engine.createTemplate(new 
File("${projectBaseDir}/glv/NamingConversions.template")).make(["body":body])
-def namingConversionsFile = new 
File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/NamingConversions.cs")
-namingConversionsFile.newWriter().withWriter{ it << namingConversionsTemplate }
+        each { createEnum(it) }
 
 def determineVersion = {
     def env = System.getenv()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 555d372..6c00f99 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs
@@ -26,9 +26,14 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Barrier
+    public class Barrier : EnumWrapper
     {
-        NormSack
+        private Barrier(string enumValue)
+            : base("Barrier", enumValue)
+        {            
+        }
+
+        public static Barrier NormSack => new Barrier("normSack");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 5a07258..f158153 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs
@@ -26,11 +26,16 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Cardinality
+    public class Cardinality : EnumWrapper
     {
-        List,
-               Set,
-               Single
+        private Cardinality(string enumValue)
+            : base("Cardinality", enumValue)
+        {            
+        }
+
+        public static Cardinality List => new Cardinality("list");
+               public static Cardinality Set => new Cardinality("set");
+               public static Cardinality Single => new Cardinality("single");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 432323f..3daaa4d 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs
@@ -26,10 +26,15 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Column
+    public class Column : EnumWrapper
     {
-        Keys,
-               Values
+        private Column(string enumValue)
+            : base("Column", enumValue)
+        {            
+        }
+
+        public static Column Keys => new Column("keys");
+               public static Column Values => new Column("values");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 6f19748..9566d51 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs
@@ -26,11 +26,16 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Direction
+    public class Direction : EnumWrapper
     {
-        Both,
-               In,
-               Out
+        private Direction(string enumValue)
+            : base("Direction", enumValue)
+        {            
+        }
+
+        public static Direction Both => new Direction("BOTH");
+               public static Direction In => new Direction("IN");
+               public static Direction Out => new Direction("OUT");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/EnumWrapper.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/EnumWrapper.cs 
b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/EnumWrapper.cs
new file mode 100644
index 0000000..66b8c5a
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/EnumWrapper.cs
@@ -0,0 +1,52 @@
+#region License
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#endregion
+
+namespace Gremlin.Net.Process.Traversal
+{
+    /// <summary>
+    ///     Represents an enum.
+    /// </summary>
+    public abstract class EnumWrapper
+    {
+        /// <summary>
+        ///     Gets the name of the enum.
+        /// </summary>
+        public string EnumName { get; }
+
+        /// <summary>
+        ///     Gets the value of the enum.
+        /// </summary>
+        public string EnumValue { get; }
+
+        /// <summary>
+        ///     Initializes a new instance of the <see cref="EnumWrapper" /> 
class.
+        /// </summary>
+        /// <param name="enumName">The name of the enum.</param>
+        /// <param name="enumValue">The value of the enum.</param>
+        protected EnumWrapper(string enumName, string enumValue)
+        {
+            EnumName = enumName;
+            EnumValue = enumValue;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 e978bc6..ad73ad1 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphSONVersion.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphSONVersion.cs
@@ -26,10 +26,15 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum GraphSONVersion
+    public class GraphSONVersion : EnumWrapper
     {
-        V1_0,
-               V2_0
+        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");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 5ee7358..45387e2 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GryoVersion.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GryoVersion.cs
@@ -26,9 +26,14 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum GryoVersion
+    public class GryoVersion : EnumWrapper
     {
-        V1_0
+        private GryoVersion(string enumValue)
+            : base("GryoVersion", enumValue)
+        {            
+        }
+
+        public static GryoVersion V1_0 => new GryoVersion("V1_0");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/NamingConversions.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/NamingConversions.cs 
b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/NamingConversions.cs
deleted file mode 100644
index aecdc57..0000000
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/NamingConversions.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-
-// THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
-namespace Gremlin.Net.Process.Traversal
-{
-    internal static class NamingConversions
-    {
-        /// <summary>
-        ///     Gets the Java name equivalent for a given enum value
-        /// </summary>
-        internal static string GetEnumJavaName(string typeName, string value)
-        {
-            var key = $"{typeName}.{value}";
-            string javaName;
-            if (!CSharpToJavaEnums.TryGetValue(key, out javaName))
-            {
-                throw new KeyNotFoundException($"Java name for {key} not 
found");
-            }
-            return javaName;
-        }
-
-        internal static readonly IDictionary<string, string> CSharpToJavaEnums 
= new Dictionary<string, string>
-        {
-            {"Barrier.NormSack", "normSack"},
-            {"Cardinality.List", "list"},
-            {"Cardinality.Set", "set"},
-            {"Cardinality.Single", "single"},
-            {"Column.Keys", "keys"},
-            {"Column.Values", "values"},
-            {"Direction.Both", "BOTH"},
-            {"Direction.In", "IN"},
-            {"Direction.Out", "OUT"},
-            {"GraphSONVersion.V1_0", "V1_0"},
-            {"GraphSONVersion.V2_0", "V2_0"},
-            {"GryoVersion.V1_0", "V1_0"},
-            {"Operator.AddAll", "addAll"},
-            {"Operator.And", "and"},
-            {"Operator.Assign", "assign"},
-            {"Operator.Div", "div"},
-            {"Operator.Max", "max"},
-            {"Operator.Min", "min"},
-            {"Operator.Minus", "minus"},
-            {"Operator.Mult", "mult"},
-            {"Operator.Or", "or"},
-            {"Operator.Sum", "sum"},
-            {"Operator.SumLong", "sumLong"},
-            {"Order.Decr", "decr"},
-            {"Order.Incr", "incr"},
-            {"Order.KeyDecr", "keyDecr"},
-            {"Order.KeyIncr", "keyIncr"},
-            {"Order.Shuffle", "shuffle"},
-            {"Order.ValueDecr", "valueDecr"},
-            {"Order.ValueIncr", "valueIncr"},
-            {"Pick.Any", "any"},
-            {"Pick.None", "none"},
-            {"Pop.All", "all"},
-            {"Pop.First", "first"},
-            {"Pop.Last", "last"},
-            {"Scope.Global", "global"},
-            {"Scope.Local", "local"},
-            {"T.Id", "id"},
-            {"T.Key", "key"},
-            {"T.Label", "label"},
-            {"T.Value", "value"}
-
-        };
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 72b0048..699a5a5 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs
@@ -26,19 +26,24 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Operator
+    public class Operator : EnumWrapper
     {
-        AddAll,
-               And,
-               Assign,
-               Div,
-               Max,
-               Min,
-               Minus,
-               Mult,
-               Or,
-               Sum,
-               SumLong
+        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 SumLong => new Operator("sumLong");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 1f12710..93bf7bc 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs
@@ -26,15 +26,20 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Order
+    public class Order : EnumWrapper
     {
-        Decr,
-               Incr,
-               KeyDecr,
-               KeyIncr,
-               Shuffle,
-               ValueDecr,
-               ValueIncr
+        private Order(string enumValue)
+            : base("Order", enumValue)
+        {            
+        }
+
+        public static Order Decr => new Order("decr");
+               public static Order Incr => new Order("incr");
+               public static Order KeyDecr => new Order("keyDecr");
+               public static Order KeyIncr => new Order("keyIncr");
+               public static Order Shuffle => new Order("shuffle");
+               public static Order ValueDecr => new Order("valueDecr");
+               public static Order ValueIncr => new Order("valueIncr");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 e6394ae..a47d4a6 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs
@@ -26,10 +26,15 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Pick
+    public class Pick : EnumWrapper
     {
-        Any,
-               None
+        private Pick(string enumValue)
+            : base("Pick", enumValue)
+        {            
+        }
+
+        public static Pick Any => new Pick("any");
+               public static Pick None => new Pick("none");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 a7a8403..9e97a09 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs
@@ -26,11 +26,16 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Pop
+    public class Pop : EnumWrapper
     {
-        All,
-               First,
-               Last
+        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");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 d5af93a..65a6e67 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs
@@ -26,10 +26,15 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum Scope
+    public class Scope : EnumWrapper
     {
-        Global,
-               Local
+        private Scope(string enumValue)
+            : base("Scope", enumValue)
+        {            
+        }
+
+        public static Scope Global => new Scope("global");
+               public static Scope Local => new Scope("local");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/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 c21b50a..9eba458 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs
@@ -26,12 +26,17 @@ namespace Gremlin.Net.Process.Traversal
 {
 #pragma warning disable 1591
 
-    public enum T
+    public class T : EnumWrapper
     {
-        Id,
-               Key,
-               Label,
-               Value
+        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 Value => new T("value");
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EnumSerializer.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EnumSerializer.cs 
b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EnumSerializer.cs
index b4ab870..ccea7cd 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EnumSerializer.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EnumSerializer.cs
@@ -30,9 +30,8 @@ namespace Gremlin.Net.Structure.IO.GraphSON
     {
         public Dictionary<string, dynamic> Dictify(dynamic objectData, 
GraphSONWriter writer)
         {
-            var enumName = objectData.GetType().Name;
-            var valueJavaName = NamingConversions.GetEnumJavaName(enumName, 
objectData.ToString());
-            return GraphSONUtil.ToTypedValue(enumName, valueJavaName);
+            EnumWrapper enumToSerialize = objectData;
+            return GraphSONUtil.ToTypedValue(enumToSerialize.EnumName, 
enumToSerialize.EnumValue);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs 
b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
index a60a558..d5b7acc 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
@@ -53,7 +53,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
                 {typeof(Guid), new UuidSerializer()},
                 {typeof(DateTimeOffset), new DateSerializer()},
                 {typeof(Type), new ClassSerializer()},
-                {typeof(Enum), new EnumSerializer()},
+                {typeof(EnumWrapper), new EnumSerializer()},
                 {typeof(TraversalPredicate), new 
TraversalPredicateSerializer()},
                 {typeof(Vertex), new VertexSerializer()},
                 {typeof(Edge), new EdgeSerializer()},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dcf3da39/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
----------------------------------------------------------------------
diff --git 
a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
 
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
index c305df7..9457cae 100644
--- 
a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
+++ 
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
@@ -26,7 +26,6 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Reflection;
 using Gremlin.Net.Process.Traversal;
-using TEnum = Gremlin.Net.Process.Traversal.T;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -38,7 +37,7 @@ namespace 
Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         private readonly string _text;
 
         private static readonly IDictionary<string, Type> EnumTypesByName = 
typeof(Scope).GetTypeInfo().Assembly
-            .GetTypes().Where(t => t.GetTypeInfo().IsEnum && 
t.GetTypeInfo().IsPublic)
+            .GetTypes().Where(t => 
t.GetTypeInfo().IsSubclassOf(typeof(EnumWrapper)) && t.GetTypeInfo().IsPublic)
             .ToDictionary(e => e.Name, e => e);
         
         private readonly object _value;
@@ -55,7 +54,7 @@ namespace 
Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             }
             _type = type;
             var valueName = text.Substring(separatorIndex + 1);
-            _value = Enum.Parse(type, GetCsharpName(valueName));
+            _value = 
_type.GetProperty(GetCsharpName(valueName)).GetValue(null);
         }
 
         private string GetCsharpName(string valueText)

Reply via email to