@ Override public synchronized < T extends IRestfulClient > T newClient ( Class < T > theClientType , String theServerBase ) { validateConfigured ( ) ; if ( ! theClientType . isInterface ( ) ) { throw new ConfigurationException ( theClientType . getCanonicalName ( ) + " is not an interface" ) ; } ClientInvocationHandlerFactory invocationHandler = myInvocationHandlers . get ( theClientType ) ; if ( invocationHandler == null ) { IHttpClient httpClient = getHttpClient ( theServerBase ) ; invocationHandler = new ClientInvocationHandlerFactory ( httpClient , myContext , theServerBase , theClientType ) ; for ( Method nextMethod : theClientType . getMethods ( ) ) { BaseMethodBinding < ? > binding = BaseMethodBinding . bindMethod ( nextMethod , myContext , null ) ; invocationHandler . addBinding ( nextMethod , binding ) ; } myInvocationHandlers . put ( theClientType , invocationHandler ) ; } return instantiateProxy ( theClientType , invocationHandler . newInvocationHandler ( this ) ) ; }
Instantiates a new client instance