|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensubsystems.core.util.ClassFactory
public class ClassFactory
Purpose of this class is to make creation of configurable factories easier. It allows caller to specify class or class name of the class for which some new instance is desired. It allows derived class to perform name transformation
| Constructor Summary | |
|---|---|
ClassFactory()
Creates a new instance of DatabaseContextListener |
|
| Method Summary | |
|---|---|
protected void |
createConfiguredClassNames(java.lang.String strClassIdentifier,
java.lang.String strModifier,
java.util.List lstClassNames)
Create name for the class identified by given identifier based on configuration information. |
protected void |
createDefaultClassNames(java.lang.String strClassIdentifier,
java.lang.String strModifier,
java.util.List lstClassNames)
Create new class name based on the specified identifier and modifier. |
java.lang.Object |
createInstance(java.lang.Class clsClassIdentifier)
Create instance of the class by calling parameterless constructor. |
java.lang.Object |
createInstance(java.lang.Class clsClassIdentifier,
java.lang.Class clsDefault)
Create instance of the class by calling parameterless constructor. |
java.lang.Object |
createInstance(java.lang.String strClassIdentifier)
Create instance of the class by calling parameterless constructor. |
java.lang.Object |
createInstance(java.lang.String strClassIdentifier,
java.lang.Class clsDefault)
Create instance of the class by calling parameterless constructor. |
static ClassFactory |
getInstance()
Get the default instance so that everybody doesn't have to instantiate it all the time. |
protected java.lang.String |
getModifier()
Get modifier which should be used together with the class identifier to construct class names. |
protected java.lang.Object |
instantiateClass(java.util.List lstClassNames,
java.lang.String strClassIdentifier)
Instantiate new istance using ordered list of class names to consider. |
static void |
setInstance(ClassFactory defaultInstance)
Set default instance. |
protected void |
verifyInstance(java.lang.Object objInstance)
This method allows derived class to implement verifications if desired that the instantiated class must satisfy. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassFactory()
| Method Detail |
|---|
public static ClassFactory getInstance()
throws OSSException
OSSException - - cannot get current databasepublic static void setInstance(ClassFactory defaultInstance)
defaultInstance - - new default instancegetInstance()
public java.lang.Object createInstance(java.lang.Class clsClassIdentifier)
throws OSSException
clsClassIdentifier - - identifier of the class for which new instance
should be created
OSSException - - an error has occured
public java.lang.Object createInstance(java.lang.Class clsClassIdentifier,
java.lang.Class clsDefault)
throws OSSException
clsClassIdentifier - - identifier of the class for which new instance
should be createdclsDefault - - default class to instantiate if no other class based
on clsClassIdentifier cannot be instantiated
OSSException - - an error has occured
public java.lang.Object createInstance(java.lang.String strClassIdentifier,
java.lang.Class clsDefault)
throws OSSException
strClassIdentifier - - identifier of the class for which new instance
should be createdclsDefault - - default class to instantiate if no other class based
on clsClassIdentifier cannot be instantiated
OSSException - - an error has occured
public java.lang.Object createInstance(java.lang.String strClassIdentifier)
throws OSSException
strClassIdentifier - - identifier of the class for which new instance
should be created
OSSException - - an error has occured
protected java.lang.Object instantiateClass(java.util.List lstClassNames,
java.lang.String strClassIdentifier)
throws OSSException
lstClassNames - - ordered list of classes to consider as a template
for new instancestrClassIdentifier - - identifier of the class for which new instance
should be created, used for reporting purposes
OSSException - - an error has occured
protected void verifyInstance(java.lang.Object objInstance)
throws OSSException
objInstance - - instance to verify, can be null
OSSException - - an error has occured (e.g. verification error)
protected void createDefaultClassNames(java.lang.String strClassIdentifier,
java.lang.String strModifier,
java.util.List lstClassNames)
throws OSSException
strClassIdentifier - - identifier of the class for which new instance
should be createdstrModifier - - modifier used together with identifier to query
configured class name or null if none is availablelstClassNames - - container to add the possible class names to.
The classes will be tried in order as they are added
to this container.
OSSException - - an error has occured
protected void createConfiguredClassNames(java.lang.String strClassIdentifier,
java.lang.String strModifier,
java.util.List lstClassNames)
throws OSSException
strClassIdentifier - - identifier of the class for which new instance
should be createdstrModifier - - modifier used together with identifier to query
configured class name or null if none is availablelstClassNames - - container to add the possible class names to.
The classes will be tried in order as they are added
to this container.
OSSException - - an error has occured
protected java.lang.String getModifier()
throws OSSException
OSSException - - an error has occured
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||