org.clazzes.remoting.marshal
Interface ObjectResolver


public interface ObjectResolver

An object resolver is used to replace objects before being written to the stream or after being read from the stream. It thus accomplishes the same tasks like ObjectOutputStream.enableReplaceObject(boolean) and ObjectInputStream.enableResolveObject(boolean) for marshalers, which are not based on ObjectInputStream and ObjectOutputStream.


Method Summary
 java.lang.Object replaceWrite(java.lang.Object obj)
          Replace an object before being written to the stream.
 java.lang.Object resolvePrematureRead(java.lang.Object obj)
          Replace an object, which is referenced in the stream before resolveRead(Object) has been called.
 java.lang.Object resolveRead(java.lang.Object obj)
          Replace an object read from a stream by another one.
 

Method Detail

resolveRead

java.lang.Object resolveRead(java.lang.Object obj)
Replace an object read from a stream by another one.

Parameters:
obj - The object, which has just been received from the stream.
Returns:
The object to return to the user.

resolvePrematureRead

java.lang.Object resolvePrematureRead(java.lang.Object obj)
Replace an object, which is referenced in the stream before resolveRead(Object) has been called. This situation happens When the original object is referenced from another object which is read as part of the properties of the original object. JAVA's ObjectOutputStream returns the unresolved object in this situation. If the implementation of this method returns something different from the passed object obj, this behavior my be overwritten.

Parameters:
obj - The object, which is currently being received from the stream.
Returns:
The object to return to the user.

replaceWrite

java.lang.Object replaceWrite(java.lang.Object obj)
Replace an object before being written to the stream.

Parameters:
obj - The object to be replaced.
Returns:
The object to be written instead.


Copyright © 2010. All Rights Reserved.