Class PythonTranslator
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.process.traversal.translator.PythonTranslator
 
- 
- All Implemented Interfaces:
- Translator<String,Script>,- Translator.ScriptTranslator
 
 public final class PythonTranslator extends Object implements Translator.ScriptTranslator Translates GremlinBytecodeinto a Python string representation.- Author:
- Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classPythonTranslator.DefaultTypeTranslatorPerforms standard type translation for the TinkerPop types to Python.static classPythonTranslator.NoSugarTranslatorPerforms translation without for the syntax sugar to Python.- 
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TranslatorTranslator.ScriptTranslator, Translator.StepTranslator<S extends TraversalSource,T extends Traversal.Admin<?,?>>
 - 
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Translator.ScriptTranslatorTranslator.ScriptTranslator.AbstractTypeTranslator, Translator.ScriptTranslator.TypeTranslator
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetTargetLanguage()Get the language that the translator is converting the traversal byte code to.StringgetTraversalSource()Get theTraversalSourcerepresentation rooting this translator.static PythonTranslatorof(String traversalSource)static PythonTranslatorof(String traversalSource, boolean withParameters)Creates the translator with thePythonTranslator.DefaultTypeTranslatorpassing thewithParametersoption to it which will handle type translation in a fashion that should typically increase cache hits and reduce compilation times if enabled at the sacrifice to rewriting of the script that could reduce readability.static PythonTranslatorof(String traversalSource, Translator.ScriptTranslator.TypeTranslator typeTranslator)Creates the translator with a customTranslator.ScriptTranslator.TypeTranslatorinstance.StringtoString()Scripttranslate(Bytecode bytecode)TranslateBytecodeinto a new representation.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Translatortranslate
 
- 
 
- 
- 
- 
Method Detail- 
ofpublic static PythonTranslator of(String traversalSource) 
 - 
ofpublic static PythonTranslator of(String traversalSource, boolean withParameters) Creates the translator with thePythonTranslator.DefaultTypeTranslatorpassing thewithParametersoption to it which will handle type translation in a fashion that should typically increase cache hits and reduce compilation times if enabled at the sacrifice to rewriting of the script that could reduce readability.
 - 
ofpublic static PythonTranslator of(String traversalSource, Translator.ScriptTranslator.TypeTranslator typeTranslator) Creates the translator with a customTranslator.ScriptTranslator.TypeTranslatorinstance.
 - 
getTraversalSourcepublic String getTraversalSource() Description copied from interface:TranslatorGet theTraversalSourcerepresentation rooting this translator. For string-based translators (Translator.ScriptTranslator), this is typically a "g". For java-based translators (Translator.StepTranslator), this is typically theTraversalSourceinstance which theTraversalwill be built from.- Specified by:
- getTraversalSourcein interface- Translator<String,Script>
- Returns:
- the traversal source representation
 
 - 
translatepublic Script translate(Bytecode bytecode) Description copied from interface:TranslatorTranslateBytecodeinto a new representation. Typically, for language translations, the translation is to a string representing the traversal in the respective scripting language.- Specified by:
- translatein interface- Translator<String,Script>
- Parameters:
- bytecode- the bytecode representing traversal source and traversal manipulations.
- Returns:
- the translated object
 
 - 
getTargetLanguagepublic String getTargetLanguage() Description copied from interface:TranslatorGet the language that the translator is converting the traversal byte code to.- Specified by:
- getTargetLanguagein interface- Translator<String,Script>
- Returns:
- the language of the translation
 
 
- 
 
-