org.apache.tinkerpop.gremlin.structure.io

## Class AbstractIoRegistry

- java.lang.Object
- - org.apache.tinkerpop.gremlin.structure.io.AbstractIoRegistry

- All Implemented Interfaces:
    IoRegistry
  Direct Known Subclasses:
    CustomId.CustomIdIoRegistry, TinkerIoRegistryV1d0, TinkerIoRegistryV2d0, TinkerIoRegistryV3d0, ToyIoRegistry

      public abstract class AbstractIoRegistry
      extends Object
      implements IoRegistry

  Base implementation of the `IoRegistry` interface that provides implementation of the methods using a a `HashMap`. Providers should extend from this class if they have custom serializers to provide to IO instances. Simply register their classes to it via the provided `register(Class, Class, Object)` method.

  It is important that implementations provide a zero-arg constructor as there may be cases where it will need to be constructed via reflection. As such, calls to `register(Class, Class, Object)` should likely occur directly in the constructor.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Field Summary

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.structure.io.IoRegistry

      `IO_REGISTRY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractIoRegistry()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<org.javatuples.Pair<Class,Object>>` | `find(Class<? extends Io> builderClass)` Find a list of all the serializers registered to an `Io` class by the `Graph`.
    `<S> List<org.javatuples.Pair<Class,S>>` | `find(Class<? extends Io> builderClass, Class<S> serializerType)` Find a list of all the serializers, of a particular type, registered to an `Io` class by the `Graph`.
    `protected void` | `register(Class<? extends Io> ioClass, Class clazz, Object serializer)` Add a "serializer" for the `Mapper`.

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

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

- - ### Constructor Detail

    - #### AbstractIoRegistry

          public AbstractIoRegistry()

  - ### Method Detail

    - #### register

          protected void register(Class<? extends Io> ioClass,
                                  Class clazz,
                                  Object serializer)

      Add a "serializer" for the `Mapper`. Note that what is accepted as a "serializer" is implementation specific. An `Io` implementation will consult this registry for "serializer" classes it expects so refer to the `Io` implementation to understand what is expected for these values.
      Parameters:
        `clazz` - usually this is the class that is to be serialized - may be `null`
        `serializer` - a serializer implementation

    - #### find

          public List<org.javatuples.Pair<Class,Object>> find(Class<? extends Io> builderClass)

      Find a list of all the serializers registered to an `Io` class by the `Graph`.
      Specified by:
        `find` in interface `IoRegistry`

    - #### find

          public <S> List<org.javatuples.Pair<Class,S>> find(Class<? extends Io> builderClass,
                                                             Class<S> serializerType)

      Find a list of all the serializers, of a particular type, registered to an `Io` class by the `Graph`.
      Specified by:
        `find` in interface `IoRegistry`

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