org.d_haven.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.

Version:
CVS $Revision: 1.4 $ $Date: 2004/06/21 17:03:46 $
Author:
Berin Loritsch

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

Method Detail

newInstance

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

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

getCreatedClass

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

Returns:
Class object of the factory's class

dispose

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

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


Copyright © 2004-2007 D-Haven.org. All Rights Reserved.