public <DT> Builder add(final Class<DT> type, final TypeSerializer<DT> serializer) {
            if (serializer.getDataType() == DataType.CUSTOM) {
                throw new IllegalArgumentException("DataType can not be CUSTOM, use addCustomType() method instead");
            }

            if (serializer.getDataType() == DataType.UNSPECIFIED_NULL) {
                throw new IllegalArgumentException("Adding a serializer for a UNSPECIFIED_NULL is not permitted");
            }

            if (serializer instanceof CustomTypeSerializer) {
                throw new IllegalArgumentException(
                        "CustomTypeSerializer implementations are reserved for customtypes");
            }

            list.add(new RegistryEntry<>(type, serializer));
            return this;
        }
Adds a serializer for a built-in type.
<p>
    Note that when providing a serializer for an Interface ({@link VertexProperty}, {@link Property},
    {@link 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.,
    {@link VertexProperty} before {@link Property}.
</p>
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java