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.DefaultTypeTranslator
that generates Gremlin that is compliant withgremlin-language
scripts. Specifically, it will convertDate
andTimestamp
to use thedatetime()
function. Time zone offsets are resolved to where2018-03-22T00:35:44.741+1600
would be converted todatetime('2018-03-21T08:35:44.741Z')
. More commonly2018-03-22
would simply generatedatetime('2018-03-22T00:00:00Z')
. In addition, it prefers use ofVertex
when 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 String
getSyntax(Number o)
Take the numeric argument and convert it to a string representation in the target language.protected String
getSyntax(Timestamp o)
Take theTimestamp
argument and convert it to a string representation in the target language.protected String
getSyntax(Date o)
Take theDate
argument and convert it to a string representation in the target language.protected Script
produceScript(Vertex o)
Take theVertex
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.-
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.AbstractTypeTranslator
Take theDate
argument and convert it to a string representation in the target language.- Overrides:
getSyntax
in classGroovyTranslator.DefaultTypeTranslator
-
getSyntax
protected String getSyntax(Timestamp o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theTimestamp
argument and convert it to a string representation in the target language.- Overrides:
getSyntax
in classGroovyTranslator.DefaultTypeTranslator
-
produceScript
protected Script produceScript(Vertex o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theVertex
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Overrides:
produceScript
in classGroovyTranslator.DefaultTypeTranslator
-
getSyntax
protected String getSyntax(Number o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take 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 theNumber
instance itself (i.e.Double
,Integer
, etc.)- Overrides:
getSyntax
in classGroovyTranslator.DefaultTypeTranslator
-
-