code: @SuppressWarnings("unchecked")
    private T readObject(Class<T> type, BufferInput<?> buffer, Serializer serializer) {
      try {
        Constructor<?> constructor = constructorMap.get(type);
        if (constructor == null) {
          try {
            constructor = type.getDeclaredConstructor();
            constructor.setAccessible(true);
            constructorMap.put(type, constructor);
          } catch (NoSuchMethodException e) {
            throw new SerializationException("failed to instantiate reference: must provide a single argument constructor", e);
          }
        }
  
        T object = (T) constructor.newInstance();
        object.readObject(buffer, serializer);
        return object;
      } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
        throw new SerializationException("failed to instantiate object: must provide a no argument constructor", e);
      }
    }
docs: Reads an object.
  
  @param type The object type.
  @param buffer The object buffer.
  @param serializer The serializer with which the object is being read.
  @return The object.