de.spieleck.pcs.factory
Class DefaultFactory
java.lang.Object
|
+--de.spieleck.pcs.factory.DefaultFactory
- All Implemented Interfaces:
- ConfigUser, Factory
- Direct Known Subclasses:
- ActionFactory, XmlProducerFactory
- public class DefaultFactory
- extends java.lang.Object
- implements Factory
The DefaultFactory implements the Factory Interface. It can be configured
via a Properties-Object, either by specifying a file or by delievering
a Properties Object.
Field Summary |
protected java.lang.String |
configFile
|
Constructor Summary |
DefaultFactory()
Creates a new instance of DefaultFactory |
DefaultFactory(java.lang.String configFile)
creates a new instance of DefaultFactory using the given file for
configuration |
Method Summary |
java.lang.String |
getConfigFile()
Getter for property configFile. |
java.lang.Object |
getNewObject(java.lang.String key)
factory method for creating objects. |
java.util.Properties |
getProperties()
Getter for property properties. |
void |
resetConfig()
resets the configuration |
void |
setConfigFile(java.lang.String configFile)
Setter for property configFile. |
void |
setProperties(java.util.Properties properties)
Setter for property properties. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
configFile
protected java.lang.String configFile
DefaultFactory
public DefaultFactory()
- Creates a new instance of DefaultFactory
DefaultFactory
public DefaultFactory(java.lang.String configFile)
throws java.lang.IllegalArgumentException,
java.io.FileNotFoundException
- creates a new instance of DefaultFactory using the given file for
configuration
getConfigFile
public java.lang.String getConfigFile()
- Getter for property configFile.
- Specified by:
getConfigFile
in interface Factory
- Returns:
- Value of property configFile.
getNewObject
public java.lang.Object getNewObject(java.lang.String key)
throws FactoryException,
NoSuchKeyException
- factory method for creating objects. The class of the Objects is
look upped in the configuration file.
- Specified by:
getNewObject
in interface Factory
resetConfig
public void resetConfig()
- resets the configuration
- Specified by:
resetConfig
in interface ConfigUser
setConfigFile
public void setConfigFile(java.lang.String configFile)
throws java.lang.IllegalArgumentException,
java.io.FileNotFoundException
- Setter for property configFile.
- Specified by:
setConfigFile
in interface Factory
- Parameters:
configFile
- New value of property configFile.
getProperties
public java.util.Properties getProperties()
- Getter for property properties.
- Specified by:
getProperties
in interface Factory
- Returns:
- Value of property properties.
setProperties
public void setProperties(java.util.Properties properties)
- Setter for property properties.
- Specified by:
setProperties
in interface Factory
- Parameters:
properties
- New value of property properties.