com.threerings.presents.peer.util
Class PeerUtil

java.lang.Object
  extended by com.threerings.presents.peer.util.PeerUtil

public class PeerUtil
extends Object

Static methods of general utility for peer nodes.


Field Summary
protected static HashMap<Method,Method> _pmethods
          Maps provider interface methods to service interface methods.
 
Constructor Summary
PeerUtil()
           
 
Method Summary
static
<S extends InvocationProvider,T extends InvocationService<?>>
S
createProviderProxy(Class<S> clazz, T svc, Client client)
          Creates a proxy object implementing the specified provider interface (a subinterface of InvocationProvider that forwards requests to the given service implementation (a subinterface of InvocationService corresponding to the provider interface) on the specified client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_pmethods

protected static HashMap<Method,Method> _pmethods
Maps provider interface methods to service interface methods.

Constructor Detail

PeerUtil

public PeerUtil()
Method Detail

createProviderProxy

public static <S extends InvocationProvider,T extends InvocationService<?>> S createProviderProxy(Class<S> clazz,
                                                                                                  T svc,
                                                                                                  Client client)
Creates a proxy object implementing the specified provider interface (a subinterface of InvocationProvider that forwards requests to the given service implementation (a subinterface of InvocationService corresponding to the provider interface) on the specified client. This is useful for server entities that need to call a method either on the current server (with null as the caller parameter) or on a peer server.

Parameters:
clazz - the subclass of InvocationProvider desired to be implemented
svc - the implementation of the corresponding subclass of InvocationService
client - the client to pass to the service methods