gt; RpcCallBack){
> Request request = builder.sendRequest(jsonRequest, new RequestCallback() {
> @Override
> public void onResponseReceived(Request request, Response response) {
> if (200 == response.getStatusCode()) {
> // here I need detect generics type of class T
>
> ..
Due to how Java does generics by erasure, this is not possible. Instead, try
the way that GWT.create() works, where a instance of the expected class is
passed in.
For example, your method signature could be
public static final void callJSONRPCService(Class clazz,
AsyncCallback callback);
Note
()) {
// here I need detect generics type of class T
.
}
class MyRpcObject{
public parseJSONPresenter(JSONObject json){
//here is convert json object values to properties of this instance
}
}
class TestObject extends MyRpcObject{
.
}
and use it like
callJSONRPCService(new PhpRpcCallback)
or