[ 
https://issues.apache.org/jira/browse/TINKERPOP3-484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14569260#comment-14569260
 ] 

Marko A. Rodriguez commented on TINKERPOP3-484:
-----------------------------------------------

There are two ideas here I think:

  1. {{of(Class)}} is a general step for type-casting objects. And, lets say 
the class implements {{WrappedXXX}}, then it will wrap the {{Element}}.
  2. A {{SecurityTraversal}} would be a DSL that would have a step called 
{{GrantStep}}.

{code}
public Permission implements WrappedVertex<Vertex> {

  ...

  public static Permission of(final Vertex vertex) {
    return new Permission(vertex);
  }
 {code}

Actually, for 1 above, it might be nice to avoid reflection.

{code}
g.V().has('userId',32).of(Permission.of())
{code}

{code}
....
 public static Function<Vertex,Permission> of() {
    return vertex -> new Permission(vertex);
  }
}
{code}

> Consider allowing 'of' step on all elements
> -------------------------------------------
>
>                 Key: TINKERPOP3-484
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-484
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>            Reporter: Bryn Cooke
>
> DSLs would seems to be useful at an element level as well as graph level.
> For example:
> {code}
> g.V().has(T.label).of(Permission.class).grant("bryn"); //Give bryn permission 
> to element
> g.V().has(T.label).property("age").of(Permission.class).grant("bryn"); //Give 
> bryn permission to age property
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to