public static class GryoMapper.Builder extends Object implements Mapper.Builder<GryoMapper.Builder>
GryoMapper
instance.Modifier and Type | Method and Description |
---|---|
GryoMapper.Builder |
addCustom(Class... custom)
Register custom classes to serializes with gryo using default serialization.
|
GryoMapper.Builder |
addCustom(Class clazz,
Function<Kryo,Serializer> functionOfKryo)
Register a custom class to serialize with a custom serializer as returned from a
Function . |
GryoMapper.Builder |
addCustom(Class clazz,
Serializer serializer)
Register custom class to serialize with a custom serialization class.
|
GryoMapper.Builder |
addRegistry(IoRegistry registry)
Adds a vendor supplied
IoRegistry to the Mapper.Builder which enables it to check for
vendor custom serializers to add to the Mapper . |
GryoMapper.Builder |
classResolver(Supplier<ClassResolver> classResolverSupplier)
Provides a custom Kryo
ClassResolver to be supplied to a Kryo instance. |
GryoMapper |
create()
Creates a
GryoMapper . |
GryoMapper.Builder |
referenceTracking(boolean referenceTracking)
By default, each appearance of an object in the graph after the first is stored as an integer ordinal.
|
GryoMapper.Builder |
registrationRequired(boolean registrationRequired)
When set to
true , all classes serialized by the Kryo instances created from this
GryoMapper must have their classes known up front and registered appropriately through this
builder. |
GryoMapper.Builder |
version(GryoVersion version)
The version of Gryo to use in the mapper.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addRegistries
public GryoMapper.Builder addRegistry(IoRegistry registry)
IoRegistry
to the Mapper.Builder
which enables it to check for
vendor custom serializers to add to the Mapper
. All Io
implementations should expose
this method via this Mapper.Builder
so that it is compatible with Graph.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 with IoRegistry
A
added first and B
second must be read
by a Mapper
with that same registry ordering. Attempting to add B
before A
will
result in errors.addRegistry
in interface Mapper.Builder<GryoMapper.Builder>
public GryoMapper.Builder version(GryoVersion version)
addCustom(Class, Function)
and related overloads.public GryoMapper.Builder classResolver(Supplier<ClassResolver> classResolverSupplier)
ClassResolver
to be supplied to a Kryo
instance. If this value is
not supplied then it will default to the ClassResolver
of the provided GryoVersion
. To
ensure compatibility with Gryo it is highly recommended that objects passed to this method extend that class.
If the ClassResolver
implementation share state, then the Supplier
should typically create
new instances when requested, as the Supplier
will be called for each Kryo
instance created.public GryoMapper.Builder addCustom(Class... custom)
public GryoMapper.Builder addCustom(Class clazz, Serializer serializer)
public GryoMapper.Builder addCustom(Class clazz, Function<Kryo,Serializer> functionOfKryo)
Function
. Note
that calling this method for a class that is already registered will override that registration.public GryoMapper.Builder registrationRequired(boolean registrationRequired)
true
, all classes serialized by the Kryo
instances created from this
GryoMapper
must have their classes known up front and registered appropriately through this
builder. By default this value is true
. This approach is more efficient than setting the
value to false
.registrationRequired
- set to true
if the classes should be registered up front or
false
otherwisepublic GryoMapper.Builder referenceTracking(boolean referenceTracking)
referenceTracking
- set to true
to enable and false
otherwisepublic GryoMapper create()
GryoMapper
.Copyright © 2013–2021 Apache Software Foundation. All rights reserved.