net.sourceforge.groboutils.util.classes.v1
Class SingletonStore
java.lang.Object
net.sourceforge.groboutils.util.classes.v1.AbstractSingleStore
net.sourceforge.groboutils.util.classes.v1.SingletonStore
- public class SingletonStore
- extends AbstractSingleStore
Aids pluggable factories and related classes by being a central repository
for storing a singleton, and creating means to load and change the singleton.
- Since:
- March 30, 2002
- Version:
- $Date: 2003/02/10 22:52:36 $
- Author:
- Matt Albrecht groboclown@users.sourceforge.net
Constructor Summary |
SingletonStore(java.lang.Class instanceOf,
java.lang.Class defaultImpl,
java.lang.String sysPropertyKey)
Constructor specifying all the parameters for using a singleton in this
framework. |
Method Summary |
void |
setDefaultSingleton()
Sets the inner singleton to the default, which pulls from the system
property key. |
void |
setSingletonFromProperty(java.lang.String key)
Set the singleton to the class specified in the given system
property; if the class is invalid, then the default singleton class will
be used instead. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SingletonStore
public SingletonStore(java.lang.Class instanceOf,
java.lang.Class defaultImpl,
java.lang.String sysPropertyKey)
- Constructor specifying all the parameters for using a singleton in this
framework.
- Parameters:
instanceOf
- singletons must be of this class.defaultImpl
- the class which will be used if no valid
implementation class can be found.sysPropertyKey
- the system property key to reference for the name
of the implementation class.
setDefaultSingleton
public void setDefaultSingleton()
- Sets the inner singleton to the default, which pulls from the system
property key.
- Specified by:
setDefaultSingleton
in class AbstractSingleStore
setSingletonFromProperty
public void setSingletonFromProperty(java.lang.String key)
- Set the singleton to the class specified in the given system
property; if the class is invalid, then the default singleton class will
be used instead.
- Parameters:
key
- the System property to reference for the classname to
instantiate. It is passed to ClassLoadHelper
- Throws:
java.lang.IllegalArgumentException
- if key is null.- See Also:
ClassLoadHelper.createObjectFromProperty( String, Class, boolean )
Copyright © 2001-2003 by The GroboUtils Project