[ https://issues.apache.org/jira/browse/TINKERPOP-1701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16069218#comment-16069218 ]
ASF GitHub Bot commented on TINKERPOP-1701: ------------------------------------------- Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/643 All tests pass with `docker/build.sh -t -n -i` VOTE +1 > HaltedTraverserStrategy should recurse into collections for detachment. > ----------------------------------------------------------------------- > > Key: TINKERPOP-1701 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1701 > Project: TinkerPop > Issue Type: Improvement > Components: process > Affects Versions: 3.2.5 > Reporter: Marko A. Rodriguez > Assignee: Marko A. Rodriguez > > We need to make sure that {{HaltedTraverserStrategy}} recurses into > collections. This will be elegantly handled by updated {{DetachedFactory}} > and {{ReferenceFactory}} accordingly. > For instance: > {code} > public static <D> D detach(final Object object) { > if (object instanceof Element) { > return (D) ReferenceFactory.detach((Element) object); > } else if (object instanceof Property) { > return (D) ReferenceFactory.detach((Property) object); > } else if (object instanceof Path) { > return (D) ReferenceFactory.detach((Path) object); > } else if (object instanceof List) { > final List list = new ArrayList(); > for (final Object item : (List) object) { > list.add(ReferenceFactory.detach(item)); > } > return (D) list; > } else if (object instanceof Set) { > final Set set = object instanceof LinkedHashSet ? new > LinkedHashSet() : new HashSet(); > for (final Object item : (Set) object) { > set.add(ReferenceFactory.detach(item)); > } > return (D) set; > } else if (object instanceof Map) { > final Map map = object instanceof LinkedHashMap ? new > LinkedHashMap() : new HashMap(); > for (final Map.Entry<Object, Object> entry : ((Map<Object, > Object>) object).entrySet()) { > map.put(ReferenceFactory.detach(entry.getKey()), > ReferenceFactory.detach(entry.getValue())); > } > return (D) map; > } else { > return (D) object; > } > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)