| java.lang.Object net.sourceforge.groboutils.util.classes.v1.AbstractSingleStore
All known Subclasses: net.sourceforge.groboutils.util.classes.v1.SingletonStore,
AbstractSingleStore | abstract public class AbstractSingleStore (Code) | | Aids pluggable factories and related classes by being a central repository
for storing a singleton, and creating means to load and change the singleton.
author: Matt Albrecht groboclown@users.sourceforge.net version: $Date: 2003/02/10 22:52:36 $ since: March 30, 2002 |
Constructor Summary | |
public | AbstractSingleStore(Class instanceOf) Constructor specifying all the parameters for using a singleton in this
framework. |
Method Summary | |
protected static Object | createFromProperty(String key, Class defaultClass) Helper method to load an object from the class specified in the given
system property; if the class is invalid, then the given default
class will be used instead. | public Object | getSingleton() Returns the current inner singleton. | abstract protected void | setDefaultSingleton() Sets the inner singleton to the default, which is an implementation
specific method. | public synchronized void | setSingleton(Object singleton) Sets the singleton. |
AbstractSingleStore | public AbstractSingleStore(Class instanceOf)(Code) | | Constructor specifying all the parameters for using a singleton in this
framework.
Parameters: instanceOf - singletons must be of this class. |
createFromProperty | protected static Object createFromProperty(String key, Class defaultClass)(Code) | | Helper method to load an object from the class specified in the given
system property; if the class is invalid, then the given default
class will be used instead. No cast testing is performed.
Parameters: key - the System property to reference for the classname toinstantiate. It is passed to ClassLoadHelper. Parameters: defaultClass - class to instantiate if the class defined in thesystem property is invalid. the generated object. exception: IllegalArgumentException - if key is null. See Also: ClassLoadHelper.createObjectFromProperty(StringClassboolean) |
getSingleton | public Object getSingleton()(Code) | | Returns the current inner singleton. If it has never been set, then
the default will be used instead.
the inner singleton instance. exception: IllegalStateException - if no singleton was created. |
setDefaultSingleton | abstract protected void setDefaultSingleton()(Code) | | Sets the inner singleton to the default, which is an implementation
specific method.
|
setSingleton | public synchronized void setSingleton(Object singleton)(Code) | | Sets the singleton. It must be of the correct class, and non-null.
Parameters: singleton - the singleton to set. exception: IllegalArgumentException - if singleton isnull, or is not of the correct type. |
|
|