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/04/21 18:17:57 UTC

[03/12] incubator-tinkerpop git commit: Add javadoc around the revised Io interface and its revised method on Graph.

Add javadoc around the revised Io interface and its revised method on Graph.


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

Branch: refs/heads/master
Commit: 3d38e2e3a91ff4706ff202aa4e3c718ad4b5f7c9
Parents: b28252a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 12:36:06 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 12:36:06 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/Graph.java      | 12 +++++++++
 .../tinkerpop/gremlin/structure/io/Io.java      | 27 ++++++++++++++++++++
 2 files changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3d38e2e3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 8f2414b..fedda5b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
 import org.apache.tinkerpop.gremlin.structure.io.Io;
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
 import org.apache.tinkerpop.gremlin.structure.util.FeatureDescriptor;
 import org.javatuples.Pair;
 
@@ -236,6 +237,17 @@ public interface Graph extends AutoCloseable {
      */
     public Transaction tx();
 
+    /**
+     * Construct a particular {@link Io} implementation for reading and writing the {@code Graph} and other data.
+     * End-users will "select" the {@link Io} implementation that they want to use by supplying the {@link Io.Builder}
+     * that constructs it.  In this way, {@code Graph} vendors can supply their {@link IoRegistry} to that builder
+     * thus allowing for custom serializers to be auto-configured into the {@link Io} instance.  Registering custom
+     * serializers is particularly useful for those graphs that have complex types for {@link Element} identifiers.
+     * </br>
+     * For those graphs that do not need to register any custom serializers, the default implementation should suffice.
+     * If the default is overriden, take care to register the current graph to the {@link Io.Builder} via the
+     * {@link Io.Builder#graph(Graph)} method.
+     */
     public default <I extends Io> I io(final Io.Builder<I> builder) {
         return (I) builder.graph(this).create();
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3d38e2e3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
index 5abcc1f..c5ca654 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
@@ -23,6 +23,12 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import java.io.IOException;
 
 /**
+ * Ties together the core interfaces of an IO format: {@link GraphReader}, {@link GraphWriter} and {@link Mapper}.
+ * The {@link Builder} of an {@code Io} instance is supplied to {@link Graph#io(Builder)} and the {@link Graph}
+ * implementation can then chose to supply an {@link IoRegistry} to it before returning it.  An {@link Io}
+ * implementation should use that {@link IoRegistry} to lookup custom serializers to use and register them to the
+ * internal {@link Mapper} (if the format has such capability).
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface Io<R extends GraphReader.ReaderBuilder, W extends GraphWriter.WriterBuilder, M extends Mapper.Builder> {
@@ -63,9 +69,30 @@ public interface Io<R extends GraphReader.ReaderBuilder, W extends GraphWriter.W
      */
     public void read(final String file) throws IOException;
 
+    /**
+     * Helps to construct an {@link Io} implementation and should be implemented by every such implementation as
+     * that class will be passed to {@link Graph#io(Builder)} by the user.
+     */
     public interface Builder<I extends Io> {
+
+        /**
+         * Vendors use this method to supply an {@link IoRegistry} to the {@link Io} implementation.  End-users
+         * should not use this method directly.  If a user wants to register custom serializers, then such things
+         * can be done via calls to {@link Io#mapper()} after the {@link Io} is constructed via
+         * {@link Graph#io(Builder)}.
+         */
         public Builder<? extends Io> registry(final IoRegistry registry);
+
+        /**
+         * Vendors use this method to supply the current instance of their {@link Graph} to the builder.  End-users
+         * should not call this method directly.
+         */
         public Builder<? extends Io> graph(final Graph g);
+
+        /**
+         * Vendors call this method in the {@link Graph#io(Builder)} method to construct the {@link Io} instance
+         * and return the value.  End-users will typically not call this method.
+         */
         public I create();
     }
 }