Package com.ibm.ws.serialization
Interface SerializationObjectReplacer
public interface SerializationObjectReplacer
Allows replacing non-serializable objects prior to serialization. Typical
scenarios are:
- A bundle does not want to allow its object to be serialized arbitrarily by user code (e.g., because the object itself contains references to other objects that aren't visible to that bundle). In this case, the bundle would not mark its objects Serializable to disallow serialization.
- A bundle wants to allow serialization of a known object from another bundle, which normally does not allow serialization of its objects.
In either case, the bundle would provide a replacer to recognize the
object and return a serialized form, and would add a resolveObject method to
the class of the serialized form class to recreate the original object. Note
that the class of the serialized form will typically need to be made visible
via DeserializationClassProvider
.
-
Method Summary
Modifier and TypeMethodDescriptionreplaceObject
(Object object) Replaces non-serialization objects prior to serialization.
-
Method Details
-
replaceObject
Replaces non-serialization objects prior to serialization. If the implementation does not recognize the object then null should be returned. If an object is returned, it must be either Serializable or Externalizable.Implementations are strongly encouraged to annotate the parameter with
Sensitive
to avoid tracing user data.- Parameters:
object
- the object being serialized- Returns:
- the replacement object, or null if no replacement is needed
-