com.peterphi.std.guice.web.rest.setup.JAXRSClientProvider Maven / Gradle / Ivy
package com.peterphi.std.guice.web.rest.setup;
import com.google.inject.Inject;
import com.google.inject.TypeLiteral;
import com.peterphi.std.guice.restclient.JAXRSProxyClientFactory;
import javax.inject.Provider;
/**
* Builds JAX-RS Proxy Clients for interfaces using {@link com.peterphi.std.guice.restclient.JAXRSProxyClientFactory#getClient(Class)}
*
* @param
*/
class JAXRSClientProvider implements Provider
{
private final Class extends T> iface;
private final JAXRSProxyClientFactory clientFactory;
@Inject
public JAXRSClientProvider(final TypeLiteral iface, final JAXRSProxyClientFactory clientFactory)
{
this.iface = (Class) iface.getRawType();
this.clientFactory = clientFactory;
}
@Override
public T get()
{
return clientFactory.getClient(iface);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy