Class Translator.ScriptTranslator.AbstractTypeTranslator
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.process.traversal.Translator.ScriptTranslator.AbstractTypeTranslator
-
- All Implemented Interfaces:
BiFunction<String,Object,Script>
,Translator.ScriptTranslator.TypeTranslator
- Enclosing interface:
- Translator.ScriptTranslator
public abstract static class Translator.ScriptTranslator.AbstractTypeTranslator extends Object implements Translator.ScriptTranslator.TypeTranslator
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
ANONYMOUS_TRAVERSAL_PREFIX
protected Script
script
protected boolean
withParameters
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTypeTranslator(boolean withParameters)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Script
apply(String traversalSource, Object o)
protected Script
convertToScript(Object object)
For each operator argument, if withParameters set true, try parametrization as follows: ----------------------------------------------- if unpack, why ? ObjectType ----------------------------------------------- (Yes) Bytecode.Binding (Recursion, No) Bytecode (Recursion, No) Traversal (Yes) String (Recursion, No) Set (Recursion, No) List (Recursion, No) Map (Yes) Long (Yes) Double (Yes) Float (Yes) Integer (Yes) Timestamp (Yes) Date (Yes) Uuid (Recursion, No) P (Enumeration, No) SackFunctions.Barrier (Enumeration, No) VertexProperty.Cardinality (Enumeration, No) TraversalOptionParent.Pick (Enumeration, No) Enum (Recursion, No) Vertex (Recursion, No) Edge (Recursion, No) VertexProperty (Yes) Lambda (Recursion, No) TraversalStrategyProxy (Enumeration, No) TraversalStrategy (Yes) Other -------------------------------------------------protected String
getAnonymousTraversalPrefix()
Gets the syntax for the spawn of an anonymous traversal which is traditionally the double underscore.protected abstract String
getNullSyntax()
Gets the syntax for anull
value as a string representation.protected abstract String
getSyntax(Boolean o)
Take the boolean argument and convert it to a string representation in the target language.protected abstract String
getSyntax(Number o)
Take the numeric argument and convert it to a string representation in the target language.protected abstract String
getSyntax(String o)
Take the string argument and convert it to a string representation in the target language (i.e.protected abstract String
getSyntax(Timestamp o)
Take theTimestamp
argument and convert it to a string representation in the target language.protected abstract String
getSyntax(Date o)
Take theDate
argument and convert it to a string representation in the target language.protected abstract String
getSyntax(UUID o)
Take theUUID
argument and convert it to a string representation in the target language.protected abstract String
getSyntax(SackFunctions.Barrier o)
Take theSackFunctions.Barrier
argument and convert it to a string representation in the target language.protected abstract String
getSyntax(org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent.Pick o)
Take theTraversalOptionParent.Pick
argument and convert it to a string representation in the target language.protected abstract String
getSyntax(VertexProperty.Cardinality o)
Take theVertexProperty.Cardinality
argument and convert it to a string representation in the target language.protected abstract String
getSyntax(org.apache.tinkerpop.gremlin.util.function.Lambda o)
Take theLambda
argument and convert it to a string representation in the target language.protected abstract Script
produceScript(Class<?> o)
Take theClass
and writes the syntax directly to the memberscript
variable.protected abstract Script
produceScript(Enum<?> o)
Take theEnum
and writes the syntax directly to the memberscript
variable.protected abstract Script
produceScript(String traversalSource, Bytecode o)
protected abstract Script
produceScript(List<?> o)
Take theList
and writes the syntax directly to the memberscript
variable.protected abstract Script
produceScript(Map<?,?> o)
Take theMap
and writes the syntax directly to the memberscript
variable.protected abstract Script
produceScript(Set<?> o)
Take theSet
and writes the syntax directly to the memberscript
variable.protected abstract Script
produceScript(P<?> p)
protected abstract Script
produceScript(org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy<?> o)
Take theTraversalStrategyProxy
and writes the syntax directly to the memberscript
variable.protected abstract Script
produceScript(Edge o)
protected abstract Script
produceScript(Vertex o)
protected abstract Script
produceScript(VertexProperty<?> o)
Take theVertexProperty
and writes the syntax directly to the memberscript
variable.-
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
-
-
-
-
Field Detail
-
ANONYMOUS_TRAVERSAL_PREFIX
protected static final String ANONYMOUS_TRAVERSAL_PREFIX
- See Also:
- Constant Field Values
-
withParameters
protected final boolean withParameters
-
script
protected final Script script
-
-
Method Detail
-
apply
public Script apply(String traversalSource, Object o)
- Specified by:
apply
in interfaceBiFunction<String,Object,Script>
-
getAnonymousTraversalPrefix
protected String getAnonymousTraversalPrefix()
Gets the syntax for the spawn of an anonymous traversal which is traditionally the double underscore.
-
getNullSyntax
protected abstract String getNullSyntax()
Gets the syntax for anull
value as a string representation.
-
getSyntax
protected abstract String getSyntax(String o)
Take the string argument and convert it to a string representation in the target language (i.e. escape, enclose in appropriate quotes, etc.)
-
getSyntax
protected abstract String getSyntax(Boolean o)
Take the boolean argument and convert it to a string representation in the target language.
-
getSyntax
protected abstract String getSyntax(Date o)
Take theDate
argument and convert it to a string representation in the target language.
-
getSyntax
protected abstract String getSyntax(Timestamp o)
Take theTimestamp
argument and convert it to a string representation in the target language.
-
getSyntax
protected abstract String getSyntax(UUID o)
Take theUUID
argument and convert it to a string representation in the target language.
-
getSyntax
protected abstract String getSyntax(org.apache.tinkerpop.gremlin.util.function.Lambda o)
Take theLambda
argument and convert it to a string representation in the target language.
-
getSyntax
protected abstract String getSyntax(SackFunctions.Barrier o)
Take theSackFunctions.Barrier
argument and convert it to a string representation in the target language.
-
getSyntax
protected abstract String getSyntax(VertexProperty.Cardinality o)
Take theVertexProperty.Cardinality
argument and convert it to a string representation in the target language.
-
getSyntax
protected abstract String getSyntax(org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent.Pick o)
Take theTraversalOptionParent.Pick
argument and convert it to a string representation in the target language.
-
getSyntax
protected abstract String getSyntax(Number o)
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.)
-
produceScript
protected abstract Script produceScript(Set<?> o)
Take theSet
and writes the syntax directly to the memberscript
variable.
-
produceScript
protected abstract Script produceScript(List<?> o)
Take theList
and writes the syntax directly to the memberscript
variable.
-
produceScript
protected abstract Script produceScript(Map<?,?> o)
Take theMap
and writes the syntax directly to the memberscript
variable.
-
produceScript
protected abstract Script produceScript(Class<?> o)
Take theClass
and writes the syntax directly to the memberscript
variable.
-
produceScript
protected abstract Script produceScript(Enum<?> o)
Take theEnum
and writes the syntax directly to the memberscript
variable.
-
produceScript
protected abstract Script produceScript(VertexProperty<?> o)
Take theVertexProperty
and writes the syntax directly to the memberscript
variable.
-
produceScript
protected abstract Script produceScript(org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy<?> o)
Take theTraversalStrategyProxy
and writes the syntax directly to the memberscript
variable.
-
convertToScript
protected Script convertToScript(Object object)
For each operator argument, if withParameters set true, try parametrization as follows: ----------------------------------------------- if unpack, why ? ObjectType ----------------------------------------------- (Yes) Bytecode.Binding (Recursion, No) Bytecode (Recursion, No) Traversal (Yes) String (Recursion, No) Set (Recursion, No) List (Recursion, No) Map (Yes) Long (Yes) Double (Yes) Float (Yes) Integer (Yes) Timestamp (Yes) Date (Yes) Uuid (Recursion, No) P (Enumeration, No) SackFunctions.Barrier (Enumeration, No) VertexProperty.Cardinality (Enumeration, No) TraversalOptionParent.Pick (Enumeration, No) Enum (Recursion, No) Vertex (Recursion, No) Edge (Recursion, No) VertexProperty (Yes) Lambda (Recursion, No) TraversalStrategyProxy (Enumeration, No) TraversalStrategy (Yes) Other -------------------------------------------------- Parameters:
object
-- Returns:
- String Repres
-
-