class ValueReader<T>
        implements SizedReader<T>, BytesReader<T>, StatefulCopyable<ValueReader<T>> {

    /**
     * Config field
     */
    private Class<T> valueType;

    // Cache fields
    private transient Class<? extends T> nativeClass;
    private transient Class<? extends T> heapClass;
    private transient Byteable nativeReference;

    public ValueReader(Class<T> valueType) {
        this.valueType = valueType;
        initTransients();
    }

    /**
     * Returns the interface of values deserialized.
     */
    protected Class<T> valueType() {
        return valueType;
    }

    protected Class<? extends T> nativeClass() {
        return nativeClass;
    }

    protected Class<? extends T> heapClass() {
        return heapClass;
    }

    private void initTransients() {<FILL_FUNCTION_BODY>}

    protected T createInstance() {
        try {
            return heapClass.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }

    @NotNull
    @Override
    public T read(@NotNull Bytes in, long size, @Nullable T using) {
        if (size != nativeReference.maxSize())
            throw new IllegalArgumentException();
        return read(in, using);
    }

    @NotNull
    @Override
    public T read(Bytes in, @Nullable T using) {
        if (using != null && using.getClass() == nativeClass) {
            ((Byteable) using).bytesStore(in.bytesStore(), in.readPosition(),
                    nativeReference.maxSize());
            return using;
        }
        if (using == null)
            using = createInstance();
        nativeReference.bytesStore(in.bytesStore(), in.readPosition(),
                nativeReference.maxSize());
        ((Copyable) using).copyFrom(nativeReference);
        return using;
    }

    @Override
    public ValueReader<T> copy() {
        return new ValueReader<>(valueType);
    }

    @Override
    public void readMarshallable(@NotNull WireIn wireIn) {
        valueType = wireIn.read(() -> "valueType").typeLiteral();
        initTransients();
    }

    @Override
    public void writeMarshallable(@NotNull WireOut wireOut) {
        wireOut.write(() -> "valueType").typeLiteral(valueType);
    }
}

        nativeClass = Values.nativeClassFor(valueType);
        heapClass = Values.heapClassFor(valueType);
        nativeReference = (Byteable) Values.newNativeReference(valueType);
    
<no_super_class>