public final class Implements extends Object implements Invoke
When a service is remoted, wrapped in this object; clients can invoke the methods they assume this object implements. Instead of the normal method return; it will return a boolean. True will indicate that the service supports the method, otherwise it will return false. No side effects to the wrapped object will be incurred by this service. In fact; the service object will be completely unaware of the testing.
One suggested protocol: A service object could provide a public getImplements(); method, which would return a remote reference to the service object, wrapped by an Implements instance. A new reference needn't be created for each call, and in fact, the reference can even be instantiated lazily, i.e. if needed.
As a template:
private Remote myImplements;
public RemoteInvoke getImplements() throws java.rmi.RemoteException {
return myImplements == null ?
myImplements = new Remote(new Implements(this)) : myImplements;
}| Constructor and Description |
|---|
Implements(Object service)
The constructor takes any service object, and allows it to be remotely
tested for method existence, without having to invoke it.
|
public Implements(Object service)
service - The service object to make remotely testable for method
callability.public Object invoke(String method, Object args)
invoke in interface Invokemethod - The method to check for existenceargs - The signature of the particular method would accept, the
arguments can be null, or subclasses of the expected arguments.
Typically these are represented by class, but they also can be passed
in by instance.Copyright © 2016. All Rights Reserved.