|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.util.classes.v1.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.
Constructor Summary | |
AbstractSingleStore(java.lang.Class instanceOf)
Constructor specifying all the parameters for using a singleton in this framework. |
Method Summary | |
protected static java.lang.Object |
createFromProperty(java.lang.String key,
java.lang.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. |
java.lang.Object |
getSingleton()
Returns the current inner singleton. |
protected abstract void |
setDefaultSingleton()
Sets the inner singleton to the default, which is an implementation specific method. |
void |
setSingleton(java.lang.Object singleton)
Sets the singleton. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractSingleStore(java.lang.Class instanceOf)
instanceOf
- singletons must be of this class.Method Detail |
public java.lang.Object getSingleton()
java.lang.IllegalStateException
- if no singleton was created.public void setSingleton(java.lang.Object singleton)
singleton
- the singleton to set.
java.lang.IllegalArgumentException
- if singleton is
null, or is not of the correct type.protected abstract void setDefaultSingleton()
protected static java.lang.Object createFromProperty(java.lang.String key, java.lang.Class defaultClass)
key
- the System property to reference for the classname to
instantiate. It is passed to ClassLoadHelper.defaultClass
- class to instantiate if the class defined in the
system property is invalid.
java.lang.IllegalArgumentException
- if key is null.ClassLoadHelper.createObjectFromProperty( String, Class, boolean )
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |