public void refresh() { synchronized (getMonitor()) { AccessGrant accessGrant = serviceProvider.getOAuthOperations().refreshAccess(refreshToken, null, null); initAccessTokens( accessGrant.getAccessToken(), accessGrant.getRefreshToken(), accessGrant.getExpireTime()); initApi(); } }
@SuppressWarnings("unchecked") private void initApiProxy() { Class<?> apiType = GenericTypeResolver.resolveTypeArgument(serviceProvider.getClass(), ServiceProvider.class); if (apiType.isInterface()) { apiProxy = (A) Proxy.newProxyInstance( apiType.getClassLoader(), new Class[] {apiType}, new ApiInvocationHandler()); } }
private void initApi() { api = serviceProvider.getApi(accessToken); }