// Use interface from RpcManager instead of loading the class based on
// the string name to avoid problems with OSGi
Class<? extends ServerRpc> rpcInterface = rpcManager.getRpcInterface();
ServerRpcMethodInvocation invocation = new ServerRpcMethodInvocation(
connectorId, rpcInterface, methodName, parametersJson.length());
Object[] parameters = new Object[parametersJson.length()];
Type[] declaredRpcMethodParameterTypes = invocation.getMethod()
.getGenericParameterTypes();
for (int j = 0; j < parametersJson.length(); ++j) {
JsonValue parameterValue = parametersJson.get(j);
Type parameterType = declaredRpcMethodParameterTypes[j];
parameters[j] = JsonCodec.decodeInternalOrCustomType(parameterType,
parameterValue, connectorTracker);
}
invocation.setParameters(parameters);
return invocation;
}