public static class TypeSerializerRegistry.Builder extends Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
<DT> TypeSerializerRegistry.Builder |
add(Class<DT> type,
TypeSerializer<DT> serializer)
Adds a serializer for a built-in type.
|
<DT> TypeSerializerRegistry.Builder |
addCustomType(Class<DT> type,
CustomTypeSerializer<DT> serializer)
Adds a serializer for a custom type.
|
TypeSerializerRegistry |
create()
Creates a new
TypeSerializerRegistry instance based on the serializers added. |
TypeSerializerRegistry.Builder |
withFallbackResolver(Function<Class<?>,TypeSerializer<?>> fallbackResolver)
Provides a way to resolve the type serializer to use when there isn't any direct match.
|
public <DT> TypeSerializerRegistry.Builder add(Class<DT> type, TypeSerializer<DT> serializer)
Note that when providing a serializer for an Interface (VertexProperty
, Property
,
Vertex
, ...), the serializer resolution from the registry will be defined by the order that
it was provided. In this case, you should provide the type serializer starting from most specific to
less specific or to put it in other words, start from derived types and then parent types, e.g.,
VertexProperty
before Property
.
public <DT> TypeSerializerRegistry.Builder addCustomType(Class<DT> type, CustomTypeSerializer<DT> serializer)
public TypeSerializerRegistry.Builder withFallbackResolver(Function<Class<?>,TypeSerializer<?>> fallbackResolver)
public TypeSerializerRegistry create()
TypeSerializerRegistry
instance based on the serializers added.Copyright © 2013–2019 Apache Software Foundation. All rights reserved.