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 StringgetNullSyntax()Gets the syntax for anullvalue as a string representation.protected StringgetSyntax(Boolean o)Take the boolean argument and convert it to a string representation in the target language.protected StringgetSyntax(Number o)Take the numeric argument and convert it to a string representation in the target language.protected StringgetSyntax(String o)Take the string argument and convert it to a string representation in the target language (i.e.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 StringgetSyntax(UUID o)Take theUUIDargument and convert it to a string representation in the target language.protected StringgetSyntax(SackFunctions.Barrier o)Take theSackFunctions.Barrierargument and convert it to a string representation in the target language.protected StringgetSyntax(TraversalOptionParent.Pick o)Take theTraversalOptionParent.Pickargument and convert it to a string representation in the target language.protected StringgetSyntax(VertexProperty.Cardinality o)Take theVertexProperty.Cardinalityargument and convert it to a string representation in the target language.protected StringgetSyntax(Lambda o)Take theLambdaargument and convert it to a string representation in the target language.protected ScriptproduceScript(Class<?> o)Gets the string representation of a class with the default implementation simply checking to see if theClassis inCoreImportsor not.protected ScriptproduceScript(Enum<?> o)Take theEnumand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(String traversalSource, Bytecode bytecode)Take theBytecodeand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(List<?> o)Take theListand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(Map<?,?> o)Take theMapand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(Set<?> o)Take theSetand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(P<?> p)Take thePand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(TraversalStrategyProxy<?> o)Take theTraversalStrategyProxyand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(Edge o)Take theEdgeand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(Vertex o)Take theVertexand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.protected ScriptproduceScript(VertexProperty<?> o)Take theVertexPropertyand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.-
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.AbstractTypeTranslatorGets the syntax for anullvalue as a string representation.- Specified by:
getNullSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(String o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake the string argument and convert it to a string representation in the target language (i.e. escape, enclose in appropriate quotes, etc.)- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(Boolean o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake the boolean argument and convert it to a string representation in the target language.- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
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.- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
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.- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(UUID o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theUUIDargument and convert it to a string representation in the target language.- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(Lambda o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theLambdaargument and convert it to a string representation in the target language.- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(SackFunctions.Barrier o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theSackFunctions.Barrierargument and convert it to a string representation in the target language.- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(VertexProperty.Cardinality o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theVertexProperty.Cardinalityargument and convert it to a string representation in the target language.- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
getSyntax
protected String getSyntax(TraversalOptionParent.Pick o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theTraversalOptionParent.Pickargument and convert it to a string representation in the target language.- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
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.)- Specified by:
getSyntaxin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Set<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theSetand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(List<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theListand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Map<?,?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theMapand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin 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 theClassis inCoreImportsor not. If it is present that means it can be referenced using the simple name otherwise it uses the canonical name. Those building customTranslator.ScriptTranslatorinstances might override this if they have other classes that are not inCoreImportsby default.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Enum<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theEnumand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Vertex o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theVertexand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(Edge o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theEdgeand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(VertexProperty<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theVertexPropertyand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(TraversalStrategyProxy<?> o)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theTraversalStrategyProxyand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(String traversalSource, Bytecode bytecode)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake theBytecodeand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
produceScript
protected Script produceScript(P<?> p)
Description copied from class:Translator.ScriptTranslator.AbstractTypeTranslatorTake thePand writes the syntax directly to the memberTranslator.ScriptTranslator.AbstractTypeTranslator.scriptvariable. This implementation should also considerTextP.- Specified by:
produceScriptin classTranslator.ScriptTranslator.AbstractTypeTranslator
-
-