org.jclouds.rest.config
Class BinderUtils

java.lang.Object
  extended by org.jclouds.rest.config.BinderUtils

public class BinderUtils
extends Object

Author:
Adrian Cole

Constructor Summary
BinderUtils()
           
 
Method Summary
static
<T> void
bindAsyncClient(com.google.inject.Binder binder, Class<T> asyncClientType)
           
static
<K,V> void
bindClient(com.google.inject.Binder binder, Class<K> syncClientType, Class<V> asyncClientType, Map<Class<?>,Class<?>> delegates)
           
static
<S,A> void
bindClientAndAsyncClient(com.google.inject.Binder binder, Class<S> syncClientType, Class<A> asyncClientType)
          adds an explicit binding for a rest client, after which you can inject either the sync or async client class.
static
<S,A> void
bindClientAndAsyncClient(com.google.inject.Binder binder, Class<S> syncClientType, Class<A> asyncClientType, Map<Class<?>,Class<?>> delegates)
          adds an explicit binding for a rest client, after which you can inject either the sync or async client class.
static
<T> T
newNullProxy(Class<T> clazz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinderUtils

public BinderUtils()
Method Detail

bindClientAndAsyncClient

public static <S,A> void bindClientAndAsyncClient(com.google.inject.Binder binder,
                                                  Class<S> syncClientType,
                                                  Class<A> asyncClientType)
adds an explicit binding for a rest client, after which you can inject either the sync or async client class.

note

This client cannot have @Delegate methods, so if you have them, use the overloaded method.

Type Parameters:
S - sync client type
A - async client type (all methods have same args as client, but return listenablefuture)
Parameters:
binder - guice binder
syncClientType - interface for the sync client
asyncClientType - interface for the async client

bindClientAndAsyncClient

public static <S,A> void bindClientAndAsyncClient(com.google.inject.Binder binder,
                                                  Class<S> syncClientType,
                                                  Class<A> asyncClientType,
                                                  Map<Class<?>,Class<?>> delegates)
adds an explicit binding for a rest client, after which you can inject either the sync or async client class.

Type Parameters:
S - sync client type
A - async client type (all methods have same args as client, but return listenablefuture)
Parameters:
binder - guice binder
syncClientType - interface for the sync client (ex. LoginClient)
asyncClientType - interface for the async client (ex. LoginAsyncClient)
delegates - presuming your clients are annotated with @Delegate, contains the sync to async classes relating to these methods

bindClient

public static <K,V> void bindClient(com.google.inject.Binder binder,
                                    Class<K> syncClientType,
                                    Class<V> asyncClientType,
                                    Map<Class<?>,Class<?>> delegates)

bindAsyncClient

public static <T> void bindAsyncClient(com.google.inject.Binder binder,
                                       Class<T> asyncClientType)

newNullProxy

public static <T> T newNullProxy(Class<T> clazz)


Copyright © 2009-2012 jclouds. All Rights Reserved.