org.apache.excalibur.mpool
Interface ObjectFactory


public interface ObjectFactory

This interface is to define how an ObjectFactory is defined. While this class is not strictly necessary, the implementation of the Pool can differ object creation to and instance of this interface.

Since:
4.1.2
Version:
CVS $Revision: 1.6 $ $Date: 2003/03/22 12:46:28 $
Author:
Berin Loritsch

Field Summary
static String ROLE
           
 
Method Summary
 void dispose(Object object)
          Performs any deconstruction that is necessary for the object.
 Class getCreatedClass()
          Get the class of the object you are creating.
 Object newInstance()
          Create a new instance of the object being pooled.
 

Field Detail

ROLE

public static final String ROLE
Method Detail

newInstance

public Object newInstance()
                   throws Exception
Create a new instance of the object being pooled.

Returns:
the pooled Object instance
Throws:
Exception - if the object cannot be instantiated

getCreatedClass

public Class getCreatedClass()
Get the class of the object you are creating.

Returns:
Class object of the factory's class

dispose

public void dispose(Object object)
             throws Exception
Performs any deconstruction that is necessary for the object.

Parameters:
object - to destroy
Throws:
IllegalArgumentException - if the object is not of the same class that the factory creates.
Exception - if there is any other reason that the factory has problems disposing of the object.


Copyright © 2002 Apache Avalon Project. All Rights Reserved.