Class GroovyTranslator.LanguageTypeTranslator
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.process.traversal.Translator.ScriptTranslator.AbstractTypeTranslator
-
- org.apache.tinkerpop.gremlin.process.traversal.translator.GroovyTranslator.DefaultTypeTranslator
-
- org.apache.tinkerpop.gremlin.process.traversal.translator.GroovyTranslator.LanguageTypeTranslator
-
- All Implemented Interfaces:
BiFunction<String,Object,Script>,Translator.ScriptTranslator.TypeTranslator
- Enclosing class:
- GroovyTranslator
public static class GroovyTranslator.LanguageTypeTranslator extends GroovyTranslator.DefaultTypeTranslator
An extension of theGroovyTranslator.DefaultTypeTranslatorthat generates Gremlin that is compliant withgremlin-languagescripts. Specifically, it will convertDateandTimestampto use thedatetime()function. Time zone offsets are resolved to where2018-03-22T00:35:44.741+1600would be converted todatetime('2018-03-21T08:35:44.741Z'). More commonly2018-03-22would simply generatedatetime('2018-03-22T00:00:00Z'). In addition, it prefers use ofVertexwhen producing aReferenceVertex.
-
-
Field Summary
-
Fields inherited from class org.apache.tinkerpop.gremlin.process.traversal.Translator.ScriptTranslator.AbstractTypeTranslator
ANONYMOUS_TRAVERSAL_PREFIX, script, withParameters
-
-
Constructor Summary
Constructors Constructor Description LanguageTypeTranslator(boolean withParameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetSyntax(Number o)Take the numeric argument and convert it to a string representation in the target language.protected StringgetSyntax(Timestamp o)Take theTimestampargument and convert it to a string representation in the target language.protected StringgetSyntax(Date o)Take theDateargument and convert it to a string representation in the target language.protected ScriptproduceScript(Vertex o)Take theVertexand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.-
Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.translator.GroovyTranslator.DefaultTypeTranslator
getNullSyntax, getSyntax, getSyntax, getSyntax, getSyntax, getSyntax, getSyntax, getSyntax, produceCardinalityValue, produceScript, produceScript, produceScript, produceScript, produceScript, produceScript, produceScript, produceScript, produceScript, produceScript
-
Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.Translator.ScriptTranslator.AbstractTypeTranslator
apply, convertToScript, getAnonymousTraversalPrefix
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.function.BiFunction
andThen
-
-
-
-
Method Detail
-
getSyntax
protected String getSyntax(Date o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theDateargument and convert it to a string representation in the target language.- Overrides:
getSyntaxin classGroovyTranslator.DefaultTypeTranslator
-
getSyntax
protected String getSyntax(Timestamp o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theTimestampargument and convert it to a string representation in the target language.- Overrides:
getSyntaxin classGroovyTranslator.DefaultTypeTranslator
-
produceScript
protected Script produceScript(Vertex o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theVertexand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Overrides:
produceScriptin classGroovyTranslator.DefaultTypeTranslator
-
getSyntax
protected String getSyntax(Number o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake the numeric argument and convert it to a string representation in the target language. Languages that can discern differences in types of numbers will wish to further check the type of theNumberinstance itself (i.e.Double,Integer, etc.)- Overrides:
getSyntaxin classGroovyTranslator.DefaultTypeTranslator
-
-