@ 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 ) ; } }
Reads an object .