|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tomgibara.pronto.util.FactoryHelper<T>
T - the type of object produced by the factorypublic class FactoryHelper<T>
This class can be extended to provide a factory implementation that:
Note that instantiation of the instance is eager, but any exception is recorded and repeatedly rethrown on each call to getInstance. The eager instantiation means that this factory implementation is fast, requires no synchronization, and is thread-safe.
It is expected that this class will be used by extension, or delegation: supplying the appropriate strings to the constructor and wrapping the getInstance method to narrow the thrown Exception.
| Constructor Summary | |
|---|---|
FactoryHelper(java.lang.String className,
java.lang.ClassLoader classLoader,
java.lang.String propertyName)
Constructs a new factory which will create an instance of the class specified by either the value of the specified system property, or the supplied class name - exactly one of which may be null. |
|
| Method Summary | |
|---|---|
T |
getInstance()
The object instance created by this factory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FactoryHelper(java.lang.String className,
java.lang.ClassLoader classLoader,
java.lang.String propertyName)
className - the class to which this factory is to create, may be nullclassLoader - the class loader from which to load the class, may be nullpropertyName - a system property which overrides the specified class name| Method Detail |
|---|
public T getInstance()
throws java.lang.Exception
java.lang.Exception - the exception which occured trying to create the instance.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||