toolbox.object
Class JAMonToolboxObjectFactory

Package class diagram package JAMonToolboxObjectFactory
java.lang.Object
  extended by toolbox.object.JAMonToolboxObjectFactory
All Implemented Interfaces:
ToolboxObjectFactory

public class JAMonToolboxObjectFactory
extends java.lang.Object
implements ToolboxObjectFactory

Factory implementation to decorate created instances with JAMon instrumentation in addition to abstracting the required dynamic class loading and instantiation code.

NOTE: To successfully make use of this factory the classes must implement a defined interface or set of interfaces.

Specify the following Java system property to enable this object factory:

   -Dtoolbox.object.ToolboxObjectFactory=toolbox.object.JAMonToolboxObjectFactory
 


Constructor Summary
JAMonToolboxObjectFactory()
          Default constructor.
 
Method Summary
 java.lang.Object newInstance(java.lang.Class clazz)
          Create a new instance of the given class.
 java.lang.Object newInstance(java.lang.String clazz)
          Create a new instance of the given class.
 java.lang.Object newInstance(java.lang.String clazz, java.lang.ClassLoader loader)
          Create a new instance of the given class using the provided ClassLoader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAMonToolboxObjectFactory

public JAMonToolboxObjectFactory()
Default constructor.

Method Detail

newInstance

public java.lang.Object newInstance(java.lang.String clazz)
                             throws java.lang.Exception
Create a new instance of the given class.

Specified by:
newInstance in interface ToolboxObjectFactory
Parameters:
clazz - String containing the name of the class.
Returns:
Object containing an instance of given class.
Throws:
java.lang.Exception - if the Object cannot be created.

newInstance

public java.lang.Object newInstance(java.lang.Class clazz)
                             throws java.lang.Exception
Create a new instance of the given class.

Specified by:
newInstance in interface ToolboxObjectFactory
Parameters:
clazz - Class instance.
Returns:
Object containing an instance of given class.
Throws:
java.lang.Exception - if the Object cannot be created.

newInstance

public java.lang.Object newInstance(java.lang.String clazz,
                                    java.lang.ClassLoader loader)
                             throws java.lang.Exception
Create a new instance of the given class using the provided ClassLoader.

Specified by:
newInstance in interface ToolboxObjectFactory
Parameters:
clazz - String containing the name of the class.
loader - ClassLoader to use when creating the Object instance.
Returns:
Object containing an instance of given class.
Throws:
java.lang.Exception - if the Object cannot be created.