code: public synchronized SerializerRegistry register(Class<?> type, int id) {
      if (type == null)
        throw new NullPointerException("type cannot be null");
  
      // Search for a default serializer for the type.
      Class<?> baseType = findBaseType(type, defaultFactories);
      if (baseType == null) {
        throw new RegistrationException("no default serializer found for type: " + type);
      }
      return register(type, id, defaultFactories.get(baseType));
    }
docs: Registers the given class for serialization.
  
  @param type The serializable class.
  @param id The serialization ID.
  @return The serializer registry.
  @throws RegistrationException If the given {@code type} is already registered or if no default
  serializer could be found for the given type.