[
https://issues.apache.org/jira/browse/TINKERPOP-2952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732022#comment-17732022
]
Stephen Mallette commented on TINKERPOP-2952:
---------------------------------------------
If you've gone so far to extend TinkerGraph then I think you should just treat
your extension as a {{Graph}} implementation. Graph implementations like
JanusGraph, TinkerGraph, Neptune, etc will not override {{GraphTraversal}} but
will instead use {{TraversalStrategy}} implementations to wholly replace step
implementations at traversal compilation time. So, you'd write a strategy that
replaces the {{PropertiesStep}} with a custom {{ObjectValuePropertiesStep}}
that makes appropriate checks and treats "parameters" differently.
Of course, when I see:
{code}
g.V().properties("parameters).properties("name")
{code}
and your structure, I can't help wondering if you couldn't just use
metaproperties for this case. it's not an exact fit for the structure you have
but it technically works without any changes on your end.
{code}
gremlin> g.addV('ObjectValue').property(single, 'parameters','ignore',
'id',123, 'name','foo')
==>v[0]
gremlin> g.V().properties('parameters').properties('name')
==>p[name->foo]
gremlin> g.V().properties('parameters').valueMap()
==>[name:foo,id:123]
{code}
> Error when overriding DSL methods
> ---------------------------------
>
> Key: TINKERPOP-2952
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2952
> Project: TinkerPop
> Issue Type: Bug
> Components: process
> Affects Versions: 3.6.2
> Reporter: Drew Nuttall-Smith
> Priority: Major
> Attachments: dsl.patch
>
>
> I'm implementing a custom gremlin DSL in java, and due to some interesting
> requirements, I'm trying to override the `properties` method from the
> GraphTraversal class.
>
> Doing so results in a compilation error (see below) due to the method already
> being defined. It looks like the DSL code generation is loading in the custom
> methods, and then loading in the built in methods and the `@Override`
> annotation is ignored.
>
>
> Error:
> {{[ERROR]
> /Users/drewnuttall-smith/Documents/work/projects/compliance/dm-mettle-nextgen-compliance/target/generated-sources/annotations/com/datamigrators/mettle/compliance/gremlin/dsl/DatastageTraversal.java:[223,62]
> method <E2>properties(java.lang.String...) is already defined in interface
> com.datamigrators.mettle.compliance.gremlin.dsl.DatastageTraversal}}
> {{[ERROR]
> /Users/drewnuttall-smith/Documents/work/projects/compliance/dm-mettle-nextgen-compliance/target/generated-sources/annotations/com/datamigrators/mettle/compliance/gremlin/dsl/__.java:[192,85]
> name clash: <A,B>properties(java.lang.String...) and
> <E2,S>properties(java.lang.String...) have the same erasure}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)