org.apache.avalon.fortress.impl.factory
Class ProxyObjectFactory
java.lang.Object
|
+--org.apache.avalon.fortress.impl.factory.AbstractObjectFactory
|
+--org.apache.avalon.fortress.impl.factory.ProxyObjectFactory
- All Implemented Interfaces:
- Instrumentable, ObjectFactory
- public final class ProxyObjectFactory
- extends AbstractObjectFactory
An ObjectFactory that delegates to another ObjectFactory
and proxies results of that factory.
- Version:
- $Revision: 1.2 $ $Date: 2003/04/22 16:12:49 $
- Author:
- Avalon Development Team
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProxyObjectFactory
public ProxyObjectFactory(ObjectFactory objectFactory)
throws NullPointerException
- Create factory that delegates to specified factory.
- Parameters:
objectFactory
- the factory to delegate to
- Throws:
NullPointerException
- if the supplied object factory is null
newInstance
public Object newInstance()
throws Exception
- Create a new instance from delegated factory and proxy it.
- Specified by:
newInstance
in interface ObjectFactory
- Specified by:
newInstance
in class AbstractObjectFactory
- Returns:
- the proxied object
- Throws:
Exception
- if unable to create new instance- See Also:
ObjectFactory.newInstance()
dispose
public void dispose(Object object)
throws Exception
- Dispose of objects created by this factory.
Involves deproxying object and delegating to real ObjectFactory.
- Specified by:
dispose
in interface ObjectFactory
- Specified by:
dispose
in class AbstractObjectFactory
- Parameters:
object
- the proxied object
- Throws:
Exception
- if unable to dispose of object- See Also:
ObjectFactory.dispose(Object)
createProxy
public static Component createProxy(Object service)
- Get the Component wrapped in the proxy.
- Parameters:
service
- the service object to proxy
getObject
public static Object getObject(Object proxy)
- Get the target object from specified proxy.
- Parameters:
proxy
- the proxy object
- Returns:
- the target object
- Throws:
NullPointerException
- if unable to aquire target object,
or specified object is not a proxy
Copyright © 2000-2002 Apache Avalon Project. All Rights Reserved.