Interface Translator<S,T>
-
- All Known Subinterfaces:
Translator.ScriptTranslator
,Translator.StepTranslator<S,T>
- All Known Implementing Classes:
DotNetTranslator
,GolangTranslator
,GroovyTranslator
,GroovyTranslator
,JavascriptTranslator
,JavaTranslator
,PythonTranslator
public interface Translator<S,T>
A Translator will translateBytecode
into another representation. That representation may be a Java instance viaTranslator.StepTranslator
or a String script in some language viaTranslator.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 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 Description String
getTargetLanguage()
Get the language that the translator is converting the traversal byte code to.S
getTraversalSource()
Get theTraversalSource
representation rooting this translator.T
translate(Bytecode bytecode)
TranslateBytecode
into a new representation.default T
translate(Traversal<?,?> t)
Translates aTraversal
into the specified form
-
-
-
Method Detail
-
getTraversalSource
S getTraversalSource()
Get theTraversalSource
representation rooting this translator. For string-based translators (Translator.ScriptTranslator
), this is typically a "g". For java-based translators (Translator.StepTranslator
), this is typically theTraversalSource
instance which theTraversal
will be built from.- Returns:
- the traversal source representation
-
translate
T translate(Bytecode bytecode)
TranslateBytecode
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
-
getTargetLanguage
String getTargetLanguage()
Get the language that the translator is converting the traversal byte code to.- Returns:
- the language of the translation
-
-