Moshi generic type adapter : <p>Suppose have the following parameterised data class representing a server response:</p>

<pre><code>public class SocketResponse&lt;T&gt; {
    private String responseMessage;
    private int responseCode;
    private T entity;
}
</code></pre>

<p>I know at runtime what type T will be. does moshi support generic type adapter the same way Gson does? With Gson id do the following to parse this. </p>

<pre><code>Type typeA = new TypeToken&lt;SocketResponse&lt;MyResponseA&gt;&gt;(){}.getType();
SocketResponse&lt;MyResponseA&gt; responseA = getResponse("json", typeA);

Type typeB = new TypeToken&lt;SocketResponse&lt;MyResponseB&gt;&gt;(){}.getType();
SocketResponse&lt;MyResponseB&gt; responseB = getResponse("json", typeB);


private String getResponse(Type t){
    return gson.fromJson(response, type);
}
</code></pre>
