Class AnonymizingTypeTranslator
- 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.AnonymizingTypeTranslator
-
- All Implemented Interfaces:
BiFunction<String,Object,Script>,Translator.ScriptTranslator.TypeTranslator
public class AnonymizingTypeTranslator extends GroovyTranslator.DefaultTypeTranslator
This Translator will translateBytecodeinto a representation that has been stripped of any user data (anonymized). A default anonymizer is provided, but can be replaced with a custom anonymizer as needed. The default anonymizer replaces any String, Numeric, Date, Timestamp, or UUID with a type-based token. Identical values will receive the same token (e.g. if "foo" is assigned "string0" then all occurrences of "foo" will be replaced with "string0").
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAnonymizingTypeTranslator.AnonymizerCustomizable anonymizer interface.static classAnonymizingTypeTranslator.DefaultAnonymizerThis default implementation keeps a map from type (Java Class) to another map from instances to anonymized token.
-
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 AnonymizingTypeTranslator()Default constructor creates aAnonymizingTypeTranslator.DefaultAnonymizer+ withParameters=false.AnonymizingTypeTranslator(boolean withParameters)AnonymizingTypeTranslator(AnonymizingTypeTranslator.Anonymizer anonymizer, 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(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 ScriptproduceScript(Class<?> o)Gets the string representation of a class with the default implementation simply checking to see if theClassis inCoreImportsor not.-
Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.translator.GroovyTranslator.DefaultTypeTranslator
getNullSyntax, 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
-
-
-
-
Constructor Detail
-
AnonymizingTypeTranslator
public AnonymizingTypeTranslator()
Default constructor creates aAnonymizingTypeTranslator.DefaultAnonymizer+ withParameters=false.
-
AnonymizingTypeTranslator
public AnonymizingTypeTranslator(boolean withParameters)
-
AnonymizingTypeTranslator
public AnonymizingTypeTranslator(AnonymizingTypeTranslator.Anonymizer anonymizer, boolean withParameters)
-
-
Method Detail
-
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.)- Overrides:
getSyntaxin classGroovyTranslator.DefaultTypeTranslator
-
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
-
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.- Overrides:
getSyntaxin 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
-
produceScript
protected Script produceScript(Class<?> o)
Description copied from class:GroovyTranslator.DefaultTypeTranslatorGets 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.- Overrides:
produceScriptin classGroovyTranslator.DefaultTypeTranslator
-
-