tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [3/4] tinkerpop git commit: Made graphson types statically initialized.
Date Tue, 23 Aug 2016 10:44:21 GMT
Made graphson types statically initialized.


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

Branch: refs/heads/TINKERPOP-1278
Commit: d05e15cd3b84b6b1ca8dcd2ba864db18f28d9901
Parents: 5739326
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Tue Aug 23 06:43:34 2016 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Tue Aug 23 06:43:34 2016 -0400

----------------------------------------------------------------------
 .../structure/io/graphson/GraphSONModule.java   | 75 ++++++++++----------
 1 file changed, 39 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d05e15cd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index 3fe4a70..21a48f3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -81,6 +81,44 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
      * Version 2.0 of GraphSON.
      */
     static final class GraphSONModuleV2d0 extends GraphSONModule {
+
+        private static final LinkedHashMap<Class, String> TYPE_DEFINITIONS = new LinkedHashMap<Class,
String>() {{
+            // Those don't have deserializers because handled by Jackson,
+            // but we still want to rename them in GraphSON
+            put(ByteBuffer.class, "bytebuffer");
+            put(Short.class, "int16");
+            put(Integer.class, "int32");
+            put(Long.class, "int64");
+            put(Double.class, "double");
+            put(Float.class, "float");
+
+            // Time serializers/deserializers
+            put(Duration.class, "duration");
+            put(Instant.class, "instant");
+            put(LocalDate.class, "localdate");
+            put(LocalDateTime.class, "localdatetime");
+            put(LocalTime.class, "localtime");
+            put(MonthDay.class, "monthday");
+            put(OffsetDateTime.class, "offsetdatetime");
+            put(OffsetTime.class, "offsettime");
+            put(Period.class, "period");
+            put(Year.class, "year");
+            put(YearMonth.class, "yearmonth");
+            put(ZonedDateTime.class, "zoneddatetime");
+            put(ZoneOffset.class, "zoneoffset");
+
+            // Tinkerpop Graph objects
+            put(Vertex.class, "vertex");
+            put(Edge.class, "edge");
+            put(Property.class, "property");
+            put(Path.class, "path");
+            put(VertexProperty.class, "vertexproperty");
+            put(Metrics.class, "metrics");
+            put(TraversalMetrics.class, "traversalmetrics");
+            put(Traverser.class, "traverser");
+            put(Tree.class, "tree");
+        }};
+
         /**
          * Constructs a new object.
          */
@@ -183,42 +221,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
 
         @Override
         public Map<Class, String> getTypeDefinitions() {
-            return new LinkedHashMap<Class, String>(){{
-                // Those don't have deserializers because handled by Jackson,
-                // but we still want to rename them in GraphSON
-                put(ByteBuffer.class, "bytebuffer");
-                put(Short.class, "int16");
-                put(Integer.class, "int32");
-                put(Long.class, "int64");
-                put(Double.class, "double");
-                put(Float.class, "float");
-
-                // Time serializers/deserializers
-                put(Duration.class, "duration");
-                put(Instant.class, "instant");
-                put(LocalDate.class, "localdate");
-                put(LocalDateTime.class, "localdatetime");
-                put(LocalTime.class, "localtime");
-                put(MonthDay.class, "monthday");
-                put(OffsetDateTime.class, "offsetdatetime");
-                put(OffsetTime.class, "offsettime");
-                put(Period.class, "period");
-                put(Year.class, "year");
-                put(YearMonth.class, "yearmonth");
-                put(ZonedDateTime.class, "zoneddatetime");
-                put(ZoneOffset.class, "zoneoffset");
-
-                // Tinkerpop Graph objects
-                put(Vertex.class, "vertex");
-                put(Edge.class, "edge");
-                put(Property.class, "property");
-                put(Path.class, "path");
-                put(VertexProperty.class, "vertexproperty");
-                put(Metrics.class, "metrics");
-                put(TraversalMetrics.class, "traversalmetrics");
-                put(Traverser.class, "traverser");
-                put(Tree.class, "tree");
-            }};
+            return TYPE_DEFINITIONS;
         }
 
         @Override


Mime
View raw message