Question

I wonder how i could possibly fix this. I want to use a vararg for the loadid and i want to add a callback. As you know varargs should be the last in the list aswel as the callback.

See the code below:

void getEvents(@Path("id") long id, @Query("number") int number, @Query("age") int age, BaseCallback<List<Event>> cb, @Query("loadId") long... loadId);
Was it helpful?

Solution

You can't in this version. In version 2 the synchronous/asynchronous behavior won't be tied to the parameters defined in the method but rather a wrapping return type.

For now, use either an array or List instead (varargs are just a fancy way to construct an array)

void getEvents(
    @Path("id") long id,
    @Query("number") int number,
    @Query("age") int age,
    @Query("loadId") List<Long> loadId,
    BaseCallback<List<Event>> cb);

or

void getEvents(
    @Path("id") long id,
    @Query("number") int number,
    @Query("age") int age,
    @Query("loadId") long[] loadId,
    BaseCallback<List<Event>> cb);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top