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 2015/09/30 21:41:59 UTC

incubator-tinkerpop git commit: Altered reader/writers to take Mapper interface in builders.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP3-728 [created] 972ae01f2


Altered reader/writers to take Mapper interface in builders.

This is a better approach as it makes it possible for different Mapper implementations to be used in the reader/writers.


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

Branch: refs/heads/TINKERPOP3-728
Commit: 972ae01f251d810989be2c720bd18f57dc71d2c0
Parents: 157ce47
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 30 15:40:01 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 30 15:40:01 2015 -0400

----------------------------------------------------------------------
 .../gremlin/structure/io/graphson/GraphSONReader.java         | 5 +++--
 .../gremlin/structure/io/graphson/GraphSONWriter.java         | 5 +++--
 .../tinkerpop/gremlin/structure/io/gryo/GryoReader.java       | 7 ++++---
 .../tinkerpop/gremlin/structure/io/gryo/GryoWriter.java       | 7 ++++---
 4 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/972ae01f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
index 630b5f5..d10a382 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
@@ -27,6 +27,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Mapper;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.apache.tinkerpop.gremlin.structure.util.Attachable;
 import org.apache.tinkerpop.gremlin.structure.util.Host;
@@ -267,7 +268,7 @@ public final class GraphSONReader implements GraphReader {
     public final static class Builder implements ReaderBuilder<GraphSONReader> {
         private long batchSize = 10000;
 
-        private GraphSONMapper mapper = GraphSONMapper.build().create();
+        private Mapper<ObjectMapper> mapper = GraphSONMapper.build().create();
         private boolean unwrapAdjacencyList = false;
 
         private Builder() {}
@@ -286,7 +287,7 @@ public final class GraphSONReader implements GraphReader {
          * options with this mapper.  If this value is set to something other than null then that value will be
          * used to construct the writer.
          */
-        public Builder mapper(final GraphSONMapper mapper) {
+        public Builder mapper(final Mapper<ObjectMapper> mapper) {
             this.mapper = mapper;
             return this;
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/972ae01f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
index f8ddf92..04818d6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Mapper;
 import org.apache.tinkerpop.gremlin.structure.util.star.StarGraph;
 import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializer;
 import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper;
@@ -184,7 +185,7 @@ public final class GraphSONWriter implements GraphWriter {
 
     public static class Builder implements WriterBuilder<GraphSONWriter> {
 
-        private GraphSONMapper mapper = GraphSONMapper.build().create();
+        private Mapper<ObjectMapper> mapper = GraphSONMapper.build().create();
         private boolean wrapAdjacencyList = false;
 
         private Builder() { }
@@ -193,7 +194,7 @@ public final class GraphSONWriter implements GraphWriter {
          * Override all of the builder options with this mapper.  If this value is set to something other than
          * null then that value will be used to construct the writer.
          */
-        public Builder mapper(final GraphSONMapper mapper) {
+        public Builder mapper(final Mapper<ObjectMapper> mapper) {
             this.mapper = mapper;
             return this;
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/972ae01f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
index 0080d68..084b4df 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
@@ -27,6 +27,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Mapper;
 import org.apache.tinkerpop.gremlin.structure.util.Attachable;
 import org.apache.tinkerpop.gremlin.structure.util.Host;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
@@ -62,7 +63,7 @@ public final class GryoReader implements GraphReader {
 
     private final long batchSize;
 
-    private GryoReader(final long batchSize, final GryoMapper gryoMapper) {
+    private GryoReader(final long batchSize, final Mapper<Kryo> gryoMapper) {
         this.kryo = gryoMapper.createMapper();
         this.batchSize = batchSize;
     }
@@ -252,7 +253,7 @@ public final class GryoReader implements GraphReader {
         /**
          * Always use the most recent gryo version by default
          */
-        private GryoMapper gryoMapper = GryoMapper.build().create();
+        private Mapper<Kryo> gryoMapper = GryoMapper.build().create();
 
         private Builder() {
         }
@@ -269,7 +270,7 @@ public final class GryoReader implements GraphReader {
         /**
          * Supply a mapper {@link GryoMapper} instance to use as the serializer for the {@code KryoWriter}.
          */
-        public Builder mapper(final GryoMapper gryoMapper) {
+        public Builder mapper(final Mapper<Kryo> gryoMapper) {
             this.gryoMapper = gryoMapper;
             return this;
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/972ae01f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
index d98b8c2..b3a25fa 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Mapper;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 import org.apache.tinkerpop.gremlin.structure.util.star.StarGraph;
 import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGryoSerializer;
@@ -47,7 +48,7 @@ import java.util.Iterator;
 public final class GryoWriter implements GraphWriter {
     private Kryo kryo;
 
-    private GryoWriter(final GryoMapper gryoMapper) {
+    private GryoWriter(final Mapper<Kryo> gryoMapper) {
         this.kryo = gryoMapper.createMapper();
     }
 
@@ -162,7 +163,7 @@ public final class GryoWriter implements GraphWriter {
         /**
          * Always creates the most current version available.
          */
-        private GryoMapper gryoMapper = GryoMapper.build().create();
+        private Mapper<Kryo> gryoMapper = GryoMapper.build().create();
 
         private Builder() {
         }
@@ -170,7 +171,7 @@ public final class GryoWriter implements GraphWriter {
         /**
          * Supply a mapper {@link GryoMapper} instance to use as the serializer for the {@code KryoWriter}.
          */
-        public Builder mapper(final GryoMapper gryoMapper) {
+        public Builder mapper(final Mapper<Kryo> gryoMapper) {
             this.gryoMapper = gryoMapper;
             return this;
         }