KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > Proxies


1 /*****************************************************************************
2  * Copyright (C) Codehaus.org. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Mar 21, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan;
15
16 /**
17  * This class provides all dynamic proxy related utility functions.
18  * Currently only setProxyImplementation is provided.
19  * <p>
20  * Codehaus.org.
21  *
22  * @author Ben Yu
23  *
24  */

25 public class Proxies {
26   /**
27    * Hot-swap implementation for a proxy object created by a proxy component.
28    * Components.proxy() and Component.proxy() methods
29    * expose a dynamic proxy instance and hide the real component instance.
30    * This method does hot-swapping, which changes the underlying
31    * real component instance to another object.
32    * @param proxy the proxied component instance.
33    * @param impl the object to change the underlying real instance to.
34    * @return true if the proxy is really created by the proxy() methods,
35    * false otherwise.
36    * @throws IllegalArgumentException if the object does not
37    * implement all the interfaces the proxy implements.
38    */

39   public static boolean setProxyImplementation(final Object JavaDoc proxy, final Object JavaDoc impl)
40   throws IllegalArgumentException JavaDoc{
41     return InstanceProxy.setImplementation(proxy, impl);
42   }
43 }
44
Popular Tags