The purpose of this class is to fine grain the transfer of some objects over the RMI connection. Implementations of
this class must have a public default constructor, and must have at least one constructor which take a single
argument of the type which is being the subject of transferring.
E.g. If a method is called with a String parameter, it can have a constructor with String, CharSequence, or other assignable classes as a single parameter. The object to be transferred must be assignable to at least one of the constructor parameter types.
1. An instance of the RMIWrapper implementation is constructer using an appropriate constructor.
2. The class of the wrapper implementation is serialized over the RMI connection.
1. The wrapper class is read from the stream by the RMI runtime.
2. The wrapper is instantiated using the public default constructor.
4. resolveWrapped() is called to retrieve the actual object to pass to the request.
Instances of this interface should only be used to configure the transfer of object and should not be used in the RMI runtime directly. I.e. do not pass instances of RMIWrapper as arguments, return values, etc... for method calls. Any passed objects will be unwrapped using getWrappedObject() regardless of use-case.
Gets the wrapped object which should be serialized during RMI transfer.
Reads the wrapped object from the RMI object input stream.
Resolves the wrapped object during deserialization.
Writes the wrapped object to the RMI object output stream.
If resolveWrapped() returned
this then this method will be called when the wrapper instance
is serialized to an other endpoint. It is preferred to return a remote proxy to the previously wrapped object to
pass back to the original endpoint when reverse request is made. Returning
this from this method
will result in the serialization of this wrapper through RMI.
The result of this method will be returned to the caller, or used during the RMI request.
Important aspect of writing objects using wrappers is that in this method if any of the object writing method is called, then the non customizable aspects of the serializable will not be applied to the object that is being wrapped.
E.g. If an RMIWrapper is defined for an object type T, then calling