org.apache.tinkerpop.gremlin.process.traversal

## Interface Translator<S,T>

- All Known Subinterfaces:
    Translator.ScriptTranslator, Translator.StepTranslator<S,T>
  All Known Implementing Classes:
    DotNetTranslator, GroovyTranslator, GroovyTranslator, JavascriptTranslator, JavaTranslator, PythonTranslator

      public interface Translator<S,T>

  A Translator will translate `Bytecode` into another representation. That representation may be a Java instance via `Translator.StepTranslator` or a String script in some language via `Translator.ScriptTranslator`. The parameterization of Translator is S (traversal source) and T (full translation).
  Author:
    Marko A. Rodriguez (http://markorodriguez.com), Stark Arya (sandszhou.zj@alibaba-inc.com), Stephen Mallette (http://stephen.genoprime.com)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Translator.ScriptTranslator` Translates bytecode to a Script representation.
    `static interface` | `Translator.StepTranslator<S extends TraversalSource,T extends Traversal.Admin<?,?>>` Translates bytecode to actual steps.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getTargetLanguage()` Get the language that the translator is converting the traversal byte code to.
    `S` | `getTraversalSource()` Get the `TraversalSource` representation rooting this translator.
    `T` | `translate(Bytecode bytecode)` Translate `Bytecode` into a new representation.
    `default T` | `translate(Traversal<?,?> t)` Translates a `Traversal` into the specified form

- - ### Method Detail

    - #### getTraversalSource

          S getTraversalSource()

      Get the `TraversalSource` representation rooting this translator. For string-based translators (`Translator.ScriptTranslator`), this is typically a "g". For java-based translators (`Translator.StepTranslator`), this is typically the `TraversalSource` instance which the `Traversal` will be built from.
      Returns:
        the traversal source representation

    - #### translate

          T translate(Bytecode bytecode)

      Translate `Bytecode` into a new representation. Typically, for language translations, the translation is to a string representing the traversal in the respective scripting language.
      Parameters:
        `bytecode` - the bytecode representing traversal source and traversal manipulations.
      Returns:
        the translated object

    - #### translate

          default T translate(Traversal<?,?> t)

      Translates a `Traversal` into the specified form

    - #### getTargetLanguage

          String getTargetLanguage()

      Get the language that the translator is converting the traversal byte code to.
      Returns:
        the language of the translation

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