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.4 $ $Date: 2004/02/28 15:16:25 $
- Author:
| Method Summary |
static Component |
createProxy(java.lang.Object service)
Get the Component wrapped in the proxy. |
void |
dispose(java.lang.Object object)
Dispose of objects created by this factory. |
static java.lang.Object |
getObject(java.lang.Object proxy)
Get the target object from specified proxy. |
java.lang.Object |
newInstance()
Create a new instance from delegated factory and proxy it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProxyObjectFactory
public ProxyObjectFactory(ObjectFactory objectFactory)
throws java.lang.NullPointerException
-
Create factory that delegates to specified factory.
- Parameters:
objectFactory - the factory to delegate to
- Throws:
java.lang.NullPointerException - if the supplied object factory is null
newInstance
public java.lang.Object newInstance()
throws java.lang.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:
java.lang.Exception - if unable to create new instance
- See Also:
ObjectFactory.newInstance()
dispose
public void dispose(java.lang.Object object)
throws java.lang.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:
java.lang.Exception - if unable to dispose of object
- See Also:
ObjectFactory.dispose(Object)
createProxy
public static Component createProxy(java.lang.Object service)
-
Get the Component wrapped in the proxy.
-
- Parameters:
service - the service object to proxy
getObject
public static java.lang.Object getObject(java.lang.Object proxy)
-
Get the target object from specified proxy.
-
- Parameters:
proxy - the proxy object
- Returns:
- the target object
- Throws:
java.lang.NullPointerException - if unable to aquire target object, or specified object is not a proxy
Please see keelframework.org for information about new Keel releases.