[
https://issues.apache.org/jira/browse/TINKERPOP3-788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14646515#comment-14646515
]
Matt Frantz commented on TINKERPOP3-788:
----------------------------------------
To provide arbitrary constructor parameters, combine {{select}} behavior.
For example, suppose the {{Person}} constructor has two parameters, {{name}}
and {{age}}, that can be supplied by {{select}}.
{noformat}
g.V().as('name', 'age')
.curry(Person.class, 'name', 'age')
.by(values('name'))
.by(values('age'))
{noformat}
Because of {{Scope.local}}, the traversal above would be equivalent to this:
{noformat}
g.V().as('name', 'age')
.select('name', 'age')
.by(values('name'))
.by(values('age'))
.map{it -> new Person(it.get().get('name'), it.get().get('age'))}
{noformat}
> Curry step
> ----------
>
> Key: TINKERPOP3-788
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-788
> Project: TinkerPop 3
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.0.0-incubating
> Reporter: Matt Frantz
> Assignee: Marko A. Rodriguez
>
> The {{curry}} step would be a way to introduce user-defined types without
> lambdas.
> {noformat}
> <E2> GraphTraversal<S, E2> curry(Class<? extends E2> c);
> {noformat}
> It would be the equivalent of a {{map}} step that instantiates the class with
> a single constructor argument provided by the traverser.
> {noformat}
> g.V().curry(MyType.class)
> g.V().<MyType>map{it -> new MyType(it.get())}
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)