private LongPollServer initServer (Resp1 r) .....
private LongPollServer initServer (Resp2 r) .....
private LongPollServer initServer (Resp3 r) .....
protected <R> void run (ApiRequest<R> req)
{
.....
LongPollServer lps = initServer((R)req.exec());
.....
}
private LongPollServer initServer (Object lpServerResponse) {
if (lpServerResponse instanceof GetLongPollServerResponse)
return new LongPollServer()
.setKey(((GetLongPollServerResponse)lpServerResponse).getKey())
.setTs(((GetLongPollServerResponse)lpServerResponse).getTs())
.setServer(((GetLongPollServerResponse)lpServerResponse).getServer());
else if (lpServerResponse instanceof com.vk.api.sdk.objects.messages.responses.GetLongPollServerResponse)
return new LongPollServer()
.setKey(((com.vk.api.sdk.objects.messages.responses.GetLongPollServerResponse)lpServerResponse).getKey())
.setTs(((com.vk.api.sdk.objects.messages.responses.GetLongPollServerResponse)lpServerResponse).getTs().toString())
.setServer(((com.vk.api.sdk.objects.messages.responses.GetLongPollServerResponse)lpServerResponse).getServer());
else
return new LongPollServer()
.setKey(((com.vk.api.sdk.objects.callback.longpoll.responses.GetLongPollServerResponse)lpServerResponse).getKey())
.setTs(((com.vk.api.sdk.objects.callback.longpoll.responses.GetLongPollServerResponse)lpServerResponse).getTs())
.setServer(((com.vk.api.sdk.objects.callback.longpoll.responses.GetLongPollServerResponse)lpServerResponse).getServer());
}