Package org.apache.commons.proxy2.serialization

The various 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

Package org.apache.commons.proxy2.serialization Description

The various 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.