org.apache.tinkerpop.gremlin.process.traversal

## Interface Translator<S,T>

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

      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)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Translator.ScriptTranslator` Translates bytecode to a string 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
    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.

- - ### 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 represenging the traversal in the respective scripting language.
      Parameters:
        `bytecode` - the byte code representing traversal source and traversal manipulations.
      Returns:
        the translated object

    - #### getTargetLanguage

          String getTargetLanguage()

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

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