com.google.api.ads.common.lib.factory
Class AdsServiceClientFactory<C extends AdsServiceClient<S,D>,S extends AdsSession,D extends AdsServiceDescriptor>

java.lang.Object
  extended by com.google.api.ads.common.lib.factory.AdsServiceClientFactory<C,S,D>
Type Parameters:
C - the type of AdsServiceClient
S - the type of AdsSession
D - the type of AdsServiceDescriptor

public class AdsServiceClientFactory<C extends AdsServiceClient<S,D>,S extends AdsSession,D extends AdsServiceDescriptor>
extends Object

Factory which creates ads service clients.

Author:
Adam Rogal

Constructor Summary
AdsServiceClientFactory(AdsServiceClientFactoryHelper adsServiceClientFactoryHelper)
          Constructor.
 
Method Summary
protected
<T> T
createServiceClientProxy(D adsServiceDescriptor, C adsServiceClient)
          Creates a proxy around the given AdsServiceClient.
<T> T
getServiceClient(S adsSession, Class<T> interfaceClass)
          Gets a client given a session and the class of the desired stub interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdsServiceClientFactory

@Inject
public AdsServiceClientFactory(AdsServiceClientFactoryHelper adsServiceClientFactoryHelper)
Constructor.

Parameters:
adsServiceClientFactoryHelper - the ads service client factory helper.
Method Detail

getServiceClient

public <T> T getServiceClient(S adsSession,
                              Class<T> interfaceClass)
                   throws ServiceException
Gets a client given a session and the class of the desired stub interface.

Type Parameters:
T - the service type
Parameters:
adsSession - the session associated with the desired client
interfaceClass - the class type of the desired client
Returns:
a client for the specified ads service
Throws:
ServiceException

createServiceClientProxy

protected <T> T createServiceClientProxy(D adsServiceDescriptor,
                                         C adsServiceClient)
Creates a proxy around the given AdsServiceClient.

Type Parameters:
T - the service type
Parameters:
adsServiceDescriptor - descriptor with information on ads service
adsServiceClient - client to be wrapped in a proxy
Returns:
the proxy


Copyright © 2012. All Rights Reserved.