All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rpcfy.RPCMethodDelegate Maven / Gradle / Ivy

Go to download

RPCfy upgrades your normal java interface to be capable of doing RPC (Remote Procedure Call).

There is a newer version: 1.0.23
Show newest version
package rpcfy;

/**
 * Represents a delegate to be called for a method in an interface is marked as {@link rpcfy.annotations.RPCfy}.
 * 

* Use this to selectively delegate a method to a local delegate instead of to be proxied through RPC * * @param The interface that is marked as {@link rpcfy.annotations.RPCfy} * * @see JsonRPCMessageHandler#addMethodDelegate(RPCMethodDelegate) */ public class RPCMethodDelegate { private Class interfaceClass; private T delegate; private int methodId; /** * Initialize this instance with the interface class and method id * * @param interfaceClass The class of interface. * @param methodId Method id, defined in the generated Proxy class. * @param delegate The instance to which this method needs to be delegated. */ public RPCMethodDelegate(Class interfaceClass, int methodId, T delegate) { this.interfaceClass = interfaceClass; this.methodId = methodId; this.delegate = delegate; } @Override public int hashCode() { return 13 * interfaceClass.hashCode() + 19 * methodId; } @Override public boolean equals(Object obj) { if (obj instanceof RPCMethodDelegate) { return ((RPCMethodDelegate) obj).interfaceClass.equals(interfaceClass) && ((RPCMethodDelegate) obj).methodId == methodId; } return false; } /** * Returns the delegated instance */ T getDelegate() { return delegate; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy