Class GryoMapper.Builder
java.lang.Object
org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper.Builder
- All Implemented Interfaces:
Mapper.Builder<GryoMapper.Builder>
- Enclosing class:
- GryoMapper
A builder to construct a
GryoMapper instance.-
Method Summary
Modifier and TypeMethodDescriptionRegister custom classes to serializes with gryo using default serialization.addCustom(Class clazz, Function<org.apache.tinkerpop.shaded.kryo.Kryo, org.apache.tinkerpop.shaded.kryo.Serializer> functionOfKryo) Register a custom class to serialize with a custom serializer as returned from aFunction.addCustom(Class clazz, SerializerShim serializer) Register custom class to serialize with a custom serialization shim.Register custom class to serialize with a custom serialization class.addRegistry(IoRegistry registry) Adds a vendor suppliedIoRegistryto theMapper.Builderwhich enables it to check for vendor custom serializers to add to theMapper.classResolver(Supplier<org.apache.tinkerpop.shaded.kryo.ClassResolver> classResolverSupplier) Provides a custom KryoClassResolverto be supplied to aKryoinstance.create()Creates aGryoMapper.referenceTracking(boolean referenceTracking) By default, each appearance of an object in the graph after the first is stored as an integer ordinal.registrationRequired(boolean registrationRequired) When set totrue, all classes serialized by theKryoinstances created from thisGryoMappermust have their classes known up front and registered appropriately through this builder.version(GryoVersion version) The version of Gryo to use in the mapper.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.tinkerpop.gremlin.structure.io.Mapper.Builder
addRegistries
-
Method Details
-
addRegistry
Adds a vendor suppliedIoRegistryto theMapper.Builderwhich enables it to check for vendor custom serializers to add to theMapper. AllIoimplementations should expose this method via thisMapper.Builderso that it is compatible withGraph.io(org.apache.tinkerpop.gremlin.structure.io.Io.Builder<I>). Successive calls to this method will add multiple registries. Registry order must be respected when doing so. In other words, data written withIoRegistryAadded first andBsecond must be read by aMapperwith that same registry ordering. Attempting to addBbeforeAwill result in errors.- Specified by:
addRegistryin interfaceMapper.Builder<GryoMapper.Builder>
-
version
The version of Gryo to use in the mapper. Defaults to 1.0. Calls to this method will reset values specified toaddCustom(Class, Function)and related overloads. -
classResolver
public GryoMapper.Builder classResolver(Supplier<org.apache.tinkerpop.shaded.kryo.ClassResolver> classResolverSupplier) Provides a custom KryoClassResolverto be supplied to aKryoinstance. If this value is not supplied then it will default to theClassResolverof the providedGryoVersion. To ensure compatibility with Gryo it is highly recommended that objects passed to this method extend that class. If theClassResolverimplementation share state, then theSuppliershould typically create new instances when requested, as theSupplierwill be called for eachKryoinstance created. -
addCustom
Register custom classes to serializes with gryo using default serialization. Note that calling this method for a class that is already registered will override that registration. -
addCustom
public GryoMapper.Builder addCustom(Class clazz, org.apache.tinkerpop.shaded.kryo.Serializer serializer) Register custom class to serialize with a custom serialization class. Note that calling this method for a class that is already registered will override that registration. -
addCustom
Register custom class to serialize with a custom serialization shim. -
addCustom
public GryoMapper.Builder addCustom(Class clazz, Function<org.apache.tinkerpop.shaded.kryo.Kryo, org.apache.tinkerpop.shaded.kryo.Serializer> functionOfKryo) Register a custom class to serialize with a custom serializer as returned from aFunction. Note that calling this method for a class that is already registered will override that registration. -
registrationRequired
When set totrue, all classes serialized by theKryoinstances created from thisGryoMappermust have their classes known up front and registered appropriately through this builder. By default this value istrue. This approach is more efficient than setting the value tofalse.- Parameters:
registrationRequired- set totrueif the classes should be registered up front orfalseotherwise
-
referenceTracking
By default, each appearance of an object in the graph after the first is stored as an integer ordinal. This allows multiple references to the same object and cyclic graphs to be serialized. This has a small amount of overhead and can be disabled to save space if it is not needed.- Parameters:
referenceTracking- set totrueto enable andfalseotherwise
-
create
Creates aGryoMapper.
-