You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2022/10/25 17:09:06 UTC

[GitHub] [tinkerpop] cole-bq commented on a diff in pull request #1843: [WIP] Properties on response elements

cole-bq commented on code in PR #1843:
URL: https://github.com/apache/tinkerpop/pull/1843#discussion_r1004745492


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedVertex.java:
##########
@@ -74,6 +75,38 @@ protected DetachedVertex(final Vertex vertex, final boolean withProperties) {
         }
     }
 
+    protected DetachedVertex(final Vertex vertex,
+                             final DetachStrategy.DetachOptions detachOptions) {
+        super(vertex);
+
+        if (detachOptions.getDetachMode() == DetachStrategy.DetachMode.NONE
+                || detachOptions.getDetachMode() == DetachStrategy.DetachMode.CUSTOM && detachOptions.getProperties() == null)
+            return;
+
+        final Iterator<VertexProperty<Object>> propertyIterator = vertex.properties();
+        if (!propertyIterator.hasNext())
+            return;
+
+        this.properties = new HashMap<>();
+
+        if (detachOptions.getDetachMode() == DetachStrategy.DetachMode.ALL) {

Review Comment:
   There is some code duplication between this case and DetachedVertex(vertex, true). Could potentially have the above constructor (DetachedVertex(final Vertex vertex, final boolean withProperties)) make calls to this constructor to avoid duplication.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org