org.huihoo.jfox.pool
Class ObjectFactoryImpl

java.lang.Object
  extended byorg.huihoo.jfox.pool.ObjectFactoryImpl
All Implemented Interfaces:
ObjectFactory
Direct Known Subclasses:
EJBObjectFactory, ProxyObjectFactory, ThreadObjectFactory

public class ObjectFactoryImpl
extends java.lang.Object
implements ObjectFactory


Field Summary
protected  java.lang.Class classType
           
 
Constructor Summary
ObjectFactoryImpl(java.lang.Class classType)
           
ObjectFactoryImpl(java.lang.String className)
           
 
Method Summary
 void destroyObject(PoolableObject object)
          destroy a poolabled object
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 java.lang.Class getObjectClass()
           
 int hashCode()
          Returns a hash code value for the object.
 PoolableObject makeObject()
          create a new poolable object
 boolean validateObject(PoolableObject object)
          Ensures that the instance is safe to be returned by the pool
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classType

protected java.lang.Class classType
Constructor Detail

ObjectFactoryImpl

public ObjectFactoryImpl(java.lang.Class classType)
                  throws java.lang.Exception

ObjectFactoryImpl

public ObjectFactoryImpl(java.lang.String className)
                  throws java.lang.Exception
Method Detail

getObjectClass

public java.lang.Class getObjectClass()
Specified by:
getObjectClass in interface ObjectFactory

makeObject

public PoolableObject makeObject()
                          throws java.lang.Exception
Description copied from interface: ObjectFactory
create a new poolable object

Specified by:
makeObject in interface ObjectFactory
Returns:
Throws:
java.lang.Exception

destroyObject

public void destroyObject(PoolableObject object)
                   throws java.lang.Exception
destroy a poolabled object

Specified by:
destroyObject in interface ObjectFactory
Parameters:
object -
Throws:
java.lang.Exception

validateObject

public boolean validateObject(PoolableObject object)
Description copied from interface: ObjectFactory
Ensures that the instance is safe to be returned by the pool

Specified by:
validateObject in interface ObjectFactory
Parameters:
object -
Returns:

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

equals

public boolean equals(java.lang.Object obj)
Description copied from class: java.lang.Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.hashCode(), Hashtable