retrofit ! returning a generic observable type
<p>I am in the process of writing code to access my Webservice from my android client. At the minute I am using retrofit to return an observable type for the various calls.At the moment I have 4 of these (shown below)</p>

<pre><code>@FormUrlEncoded
@POST("/app/{pathto}")
Observable&lt;List&lt;EntryItem&gt;&gt; getNewsAndComments(@Path("pathto") String pathto, @FieldMap Map&lt;String, String&gt; fieldnames);


/**
 * adding a comment. returns observable
 * with message entity type
 *
 * @param pathto
 * @param fieldnames
 * @return
 */

@FormUrlEncoded
@POST("/app/{pathto}")
Observable&lt;message&gt; postComment(@Path("pathto") String pathto, @FieldMap Map&lt;String, String&gt; fieldnames);


@FormUrlEncoded
@POST("/{pathto}")
Call&lt;message&gt; regDevice(@Path("pathto") String pathto ,@FieldMap Map&lt;String, String&gt; fieldnames);

/**
 * return a Map of canteen menu items!
 *
 * @param path
 * @param fielditems
 * @return
 */

@FormUrlEncoded
@POST("/app/{pathto}")
Observable&lt;Map&lt;String, ArrayList&lt;CantItem&gt;&gt;&gt; getCanteenItems(@Path("path") String path, @FieldMap Map&lt;String,String&gt; fielditems);
</code></pre>

<p>I also use a generic RestService factory to create the generic retrofit service. I stole this from a blog post I was reading :)
.</p>

<pre><code> public static &lt;T&gt; T getRetroFitService(final Class&lt;T&gt; clazz, final String endpoint)
{

    final Retrofit retrofit = new Retrofit.Builder()
            .addConverterFactory(GsonConverterFactory.create())
            .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
            .baseUrl(endpoint)
            .build();

    T service = retrofit.create(clazz);
    return service;
}
</code></pre>

<p>In my Interface where I Return of an observable etc a lot of the method calls look the same so I tried changing this to the following generic call</p>

<pre><code>Observable&lt;List&lt;T&gt;&gt;
</code></pre>

<p>Unfortunately, retrofit doesn't seem to like this. I was wondering is there any way around this so I can make the interface calls even more generic for example passing in my own  TypeAdapter to the RestServiceFactory? Also, I am relatively new to retrofit and rx-android so any advice is appreciated. Thanks!</p>