Class GroovyTranslator.DefaultTypeTranslator
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.process.traversal.Translator.ScriptTranslator.AbstractTypeTranslator
-
- org.apache.tinkerpop.gremlin.process.traversal.translator.GroovyTranslator.DefaultTypeTranslator
-
- All Implemented Interfaces:
BiFunction<String,Object,Script>
,Translator.ScriptTranslator.TypeTranslator
- Direct Known Subclasses:
AnonymizingTypeTranslator
,GroovyTranslator.LanguageTypeTranslator
- Enclosing class:
- GroovyTranslator
public static class GroovyTranslator.DefaultTypeTranslator extends Translator.ScriptTranslator.AbstractTypeTranslator
Performs standard type translation for the TinkerPop types to Groovy.
-
-
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 DefaultTypeTranslator(boolean withParameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getNullSyntax()
Gets the syntax for anull
value as a string representation.protected String
getSyntax(Boolean o)
Take the boolean argument and convert it to a string representation in the target language.protected String
getSyntax(Number o)
Take the numeric argument and convert it to a string representation in the target language.protected String
getSyntax(String o)
Take the string argument and convert it to a string representation in the target language (i.e.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 String
getSyntax(UUID o)
Take theUUID
argument and convert it to a string representation in the target language.protected String
getSyntax(Pick o)
Take thePick
argument and convert it to a string representation in the target language.protected String
getSyntax(SackFunctions.Barrier o)
Take theSackFunctions.Barrier
argument and convert it to a string representation in the target language.protected String
getSyntax(VertexProperty.Cardinality o)
Take theVertexProperty.Cardinality
argument and convert it to a string representation in the target language.protected String
getSyntax(Lambda o)
Take theLambda
argument and convert it to a string representation in the target language.protected Script
produceCardinalityValue(Bytecode o)
Take theBytecode
and write the syntax for it directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(Class<?> o)
Gets the string representation of a class with the default implementation simply checking to see if theClass
is inCoreImports
or not.protected Script
produceScript(Enum<?> o)
Take theEnum
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(String traversalSource, Bytecode bytecode)
Take theBytecode
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(List<?> o)
Take theList
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(Map<?,?> o)
Take theMap
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(Set<?> o)
Take theSet
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(P<?> p)
Take theP
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(TraversalStrategyProxy<?> o)
Take theTraversalStrategyProxy
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(Edge o)
Take theEdge
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(Vertex o)
Take theVertex
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.protected Script
produceScript(VertexProperty<?> o)
Take theVertexProperty
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.-
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
-
getNullSyntax
protected String getNullSyntax()
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Gets the syntax for anull
value as a string representation.- Specified by:
getNullSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(String o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take the string argument and convert it to a string representation in the target language (i.e. escape, enclose in appropriate quotes, etc.)- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(Boolean o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take the boolean argument and convert it to a string representation in the target language.- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
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.- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
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.- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(UUID o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theUUID
argument and convert it to a string representation in the target language.- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(Lambda o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theLambda
argument and convert it to a string representation in the target language.- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(SackFunctions.Barrier o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theSackFunctions.Barrier
argument and convert it to a string representation in the target language.- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(VertexProperty.Cardinality o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theVertexProperty.Cardinality
argument and convert it to a string representation in the target language.- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(Pick o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take thePick
argument and convert it to a string representation in the target language.- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
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.)- Specified by:
getSyntax
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceCardinalityValue
protected Script produceCardinalityValue(Bytecode o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theBytecode
and write the syntax for it directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceCardinalityValue
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Set<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theSet
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(List<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theList
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Map<?,?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theMap
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Class<?> o)
Gets the string representation of a class with the default implementation simply checking to see if theClass
is inCoreImports
or not. If it is present that means it can be referenced using the simple name otherwise it uses the canonical name. Those building customTranslator.ScriptTranslator
instances might override this if they have other classes that are not inCoreImports
by default.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Enum<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theEnum
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
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.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Edge o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theEdge
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(VertexProperty<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theVertexProperty
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(TraversalStrategyProxy<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theTraversalStrategyProxy
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(String traversalSource, Bytecode bytecode)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theBytecode
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(P<?> p)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslator
Take theP
and writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.script
variable. This implementation should also considerTextP
.- Specified by:
produceScript
in classTranslator.ScriptTranslator.AbstractTypeTranslator
-
-