org.apache.tinkerpop.gremlin.process.traversal.util

## Class ScriptTraversal<S,E>

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal<S,E>
  - - org.apache.tinkerpop.gremlin.process.traversal.util.ScriptTraversal<S,E>

- All Implemented Interfaces:
    Serializable, AutoCloseable, Cloneable, Iterator<E>, Traversal<S,E>, Traversal.Admin<S,E>

      public final class ScriptTraversal<S,E>
      extends DefaultTraversal<S,E>

  ScriptTraversal encapsulates a `ScriptEngine` and a script which is compiled into a `Traversal` at `Admin#applyStrategies()`. This is useful for serializing traversals as the compilation can happen on the remote end where the traversal will ultimately be processed.
  Author:
    Marko A. Rodriguez (http://markorodriguez.com)
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal

      `Traversal.Admin<S,E>, Traversal.Exceptions, Traversal.Symbols`

  - ### Field Summary

    - ### Fields inherited from class org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal

      `bytecode, generator, graph, locked, parent, requirements, sideEffects, steps, strategies, unmodifiableSteps`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScriptTraversal(TraversalSource traversalSource, String scriptEngine, String script, Object... bindings)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `applyStrategies()` Apply the registered `TraversalStrategies` to the traversal.

    - ### Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal

      `addStart, addStarts, addStep, asAdmin, clone, equals, getBytecode, getEndStep, getGraph, getParent, getSideEffects, getStartStep, getSteps, getStrategies, getTraverserGenerator, getTraverserRequirements, hashCode, hasNext, isLocked, next, nextTraverser, removeStep, reset, setGraph, setParent, setSideEffects, setStrategies, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin

      `addStep, equals, removeStep`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal

      `close, explain, fill, forEachRemaining, forEachRemaining, iterate, next, none, profile, promise, toBulkSet, toList, toSet, toStream, tryNext`

    - ### Methods inherited from interface java.util.Iterator

      `remove`

- - ### Constructor Detail

    - #### ScriptTraversal

          public ScriptTraversal(TraversalSource traversalSource,
                                 String scriptEngine,
                                 String script,
                                 Object... bindings)

  - ### Method Detail

    - #### applyStrategies

          public void applyStrategies()
                               throws IllegalStateException

      Description copied from interface: `Traversal.Admin`
      Apply the registered `TraversalStrategies` to the traversal. Once the strategies are applied, the traversal is "locked" and can no longer have steps added to it. The order of operations for strategy applications should be: globally id steps, apply strategies to root traversal, then to nested traversals.
      Specified by:
        `applyStrategies` in interface `Traversal.Admin<S,E>`
      Overrides:
        `applyStrategies` in class `DefaultTraversal<S,E>`
      Throws:
        `IllegalStateException` - if the `TraversalStrategies` have already been applied

Copyright © 2013–2020 Apache Software Foundation. All rights reserved.