You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Stephen Mallette (Jira)" <ji...@apache.org> on 2021/02/01 11:31:00 UTC

[jira] [Closed] (TINKERPOP-2515) Add clone method to GraphTraversal interface

     [ https://issues.apache.org/jira/browse/TINKERPOP-2515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Mallette closed TINKERPOP-2515.
---------------------------------------
    Resolution: Invalid

{{GraphTraversal}} tries to hide non-step based methods behind an {{Admin}} interface. If you want to clone you just need to access that by converting to {{GraphTraversal.Admin}} with {{GraphTraversal#asAdmin()}} at which point {{clone()}] will be accessible. It is sometimes also helpful to simply cast to {{GraphTraversal.Admin}} directly if you know you will be working with those "internal" methods. Please see javadoc for more details: https://tinkerpop.apache.org/javadocs/current/full/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.Admin.html

> Add clone method to GraphTraversal interface
> --------------------------------------------
>
>                 Key: TINKERPOP-2515
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2515
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.4.9
>            Reporter: Christopher Smith
>            Priority: Major
>
> The canonical recommendation for reusing traversal parts (e.g., I have a method that takes a {{GraphTraversal}} as a parameter, and I need to apply {{.id()}} to it) is to call {{clone()}} on the traversal. However, the interface {{GraphTraversal}} does not actually provide a {{clone()}} method, and {{Object#clone()}} is protected. The universal actual implementations {{DefaultTraversal}} and {{DefaultGraphTraversal}} explicitly expose {{clone()}}, but they're hidden behind the interfaces.
> To provide Java/STC compatibility, {{GraphTraversal}} (and possibly {{Traversal}}) should expose the {{clone()}} methods.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)