code: @SuppressWarnings("unchecked")
    private <T> T readByClass(BufferInput<?> buffer) {
      String name = buffer.readUTF8();
      if (whitelistRequired.get())
        throw new SerializationException("cannot deserialize unregistered type: " + name);
  
      Class<T> type = (Class<T>) types.get(name);
      if (type == null) {
        try {
          type = (Class<T>) Class.forName(name);
          if (type == null)
            throw new SerializationException("cannot deserialize: unknown type");
          types.put(name, type);
        } catch (ClassNotFoundException e) {
          throw new SerializationException("object class not found: " + name, e);
        }
      }
  
      TypeSerializer<T> serializer = getSerializer(type);
      if (serializer == null)
        throw new SerializationException("cannot deserialize unregistered type: " + name);
  
      return serializer.read(type, buffer, this);
    }
docs: Reads a writable object.
  
  @param buffer The buffer from which to read the object.
  @param <T> The object type.
  @return The read object.