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

stephen mallette closed TINKERPOP-787.
--------------------------------------
    Resolution: Won't Do

Now that we have published methods for building DSLs I think this is something 
best left to users to implement as they see fit. I don't think we want to try 
to implement this kind of feature across all GLVs either given that we have a 
method for allowing this type of extension through DSLs. This issue hasn't been 
touched in a while so I'm going to close it. If anyone disagrees, please 
re-open for further discussion.

> User-defined containers
> -----------------------
>
>                 Key: TINKERPOP-787
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-787
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.2-incubating
>            Reporter: Matt Frantz
>
> For any steps that create containers, we could add a modifier step (like 
> {{by}}) that allows specifying a {{Supplier}} of that container.
> {noformat}
> <E2 extends List> GraphTraversal<S, E2> withList(Supplier<E2> s);
> <E2 extends Map> GraphTraversal<S, E2> withMap(Supplier<E2> s);
> {noformat}
> In addition to providing optimized container implementations, it could 
> provide for application-specific derived container types, e.g. a Map subclass 
> with accessor methods for particular keys.
> {noformat}
> class Student extends HashMap<String, Object> {
>   public String name() { return (String)get("name"); }
>   public int schoolAge() { return (Integer)get("schoolAge"); }
> }
> {noformat}
> This in turn allows stronger type safety for traversals, since you could 
> declare the output of a Map-producing step to be your UDT.
> {noformat}
> g.V().as("name", "schoolAge")
>   .select("name", "schoolAge")
>   .<Student>withMap{->new Student()}
>   .by(values("name")
>   .by(out("school").values("age"))
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to