ProxyFactory
implementations create Serializable
proxies;
however it is not always possible or practical to serialize the complete structure of a given proxy object.See: Description
Interface | Description |
---|---|
ReadResolve |
Defines a contract around the
Object readResolve() method used by Java deserialization. |
WriteReplace |
Defines a contract around the
Object writeReplace() method used by Java deserialization. |
ProxyFactory
implementations create Serializable
proxies;
however it is not always possible or practical to serialize the complete structure of a given proxy object. The
intent of this package is to facilitate the "serialization proxy" pattern by means of the readResolve()
and
writeReplace()
methods supported by Java's serialization mechanism. This would normally be problematic with
Commons Proxy because its proxies are generalized to expose only methods declared by superclasses (where applicable)
or proxied interfaces. Therefore we declare the following interfaces:
Typically, you should define your proxy to include WriteReplace
among its interfaces, and implement it to
return some object that implements ReadResolve
(or simply declares the Object readResolve()
method
in any scope, but using the interface brings compiler assistance).
Hint: Your ReadResolve#readResolve()
implementation will typically use serialized information to recreate an
equivalent proxy object, which probably implies some form of static
access.Copyright © 2005–2014 The Apache Software Foundation. All rights reserved.