I have created the following strategy
HasStepStretegy.java
public final class HasStepStrategy extends AbstractTraversalStrategy<TraversalStrategy.ProviderOptimizationStrategy> implements TraversalStrategy.ProviderOptimizationStrategy {
private static final HasStepStrategy INSTANCE = new HasStepStrategy();
private HasStepStrategy() {
}
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
if (traversal.getStartStep instanceOf GraphStep) {
final GraphStep graphStep = (GraphStep) traversal.getStartStep();
HasStep hasStep = HasStep(traversal, new HasContainer("graphId", P.within(Arrays.asList(graphStep.getIds())));
TraversalHelper.replaceStep(hasStep, graphStep, traversal);
graphStep.clearIds();
}
}
public static TinkerGraphStepStrategy instance() {
return INSTANCE;
}
}
I have a HttpGremlinEndpointHandlerCustom.java there I have a method createBindings();
there I'm trying to call my HasStepStretegy
TraversalSource g2;
TraversalSource g = is.graphManager.getTraversal("g");
g2=.g.withStrategies(HasStepStrategy.instance().apply( ???? ))
Now this asStepStrategy.instance().apply() require Traversal.Admin as an input so how can i get that?
Also is this the right way to call this HasStepStrategy?
Can u please review my Strategy and let me know if there is anything wrong or missing?