org.apache.tinkerpop.gremlin.structure.io.binary

## Class TypeSerializerRegistry.Builder

- java.lang.Object
- - org.apache.tinkerpop.gremlin.structure.io.binary.TypeSerializerRegistry.Builder

- Enclosing class:
    TypeSerializerRegistry

      public static class TypeSerializerRegistry.Builder
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Builder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Builder

          public Builder()

  - ### Method Detail

    - #### add

          public <DT> TypeSerializerRegistry.Builder add(Class<DT> type,
                                                         TypeSerializer<DT> serializer)

      Adds a serializer for a built-in type.

      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`.

    - #### addCustomType

          public <DT> TypeSerializerRegistry.Builder addCustomType(Class<DT> type,
                                                                   CustomTypeSerializer<DT> serializer)

      Adds a serializer for a custom type.

    - #### withFallbackResolver

          public TypeSerializerRegistry.Builder withFallbackResolver(Function<Class<?>,TypeSerializer<?>> fallbackResolver)

      Provides a way to resolve the type serializer to use when there isn't any direct match.

    - #### create

          public TypeSerializerRegistry create()

      Creates a new `TypeSerializerRegistry` instance based on the serializers added.

Copyright © 2013–2021 Apache Software Foundation. All rights reserved.