Description
We need to make sure that HaltedTraverserStrategy recurses into collections. This will be elegantly handled by updated DetachedFactory and ReferenceFactory accordingly.
For instance:
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; } }
Attachments
Issue Links
- is related to
-
TINKERPOP-1474 API Alignment Between Java Gremlin Graph Structure and GLVs
- Closed
- links to