Package org.dom4j.util
Class SimpleSingleton<T>
- java.lang.Object
-
- org.dom4j.util.SimpleSingleton<T>
-
- All Implemented Interfaces:
SingletonStrategy<T>
public class SimpleSingleton<T> extends Object implements SingletonStrategy<T>
SimpleSingletonis an implementation of the SingletonStrategy interface used to provide common factory access for the same object instance. This implementation will create a new instance from the class specified and will not create a new one unless it is reset.
-
-
Constructor Summary
Constructors Constructor Description SimpleSingleton()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tinstance()voidreset()reset the instance to a new instance for the implemented strategyvoidsetSingletonClassName(String singletonClassName)set a singleton class name that will be used to create the singleton based on the strategy implementation of this interface.
-
-
-
Method Detail
-
instance
public T instance()
- Specified by:
instancein interfaceSingletonStrategy<T>- Returns:
- a singleton instance of the class specified in setSingletonClass
-
reset
public void reset()
Description copied from interface:SingletonStrategyreset the instance to a new instance for the implemented strategy- Specified by:
resetin interfaceSingletonStrategy<T>
-
setSingletonClassName
public void setSingletonClassName(String singletonClassName)
Description copied from interface:SingletonStrategyset a singleton class name that will be used to create the singleton based on the strategy implementation of this interface. The default constructor of the class will be used and must be public.- Specified by:
setSingletonClassNamein interfaceSingletonStrategy<T>- Parameters:
singletonClassName- DOCUMENT ME!
-
-