frysk.gui.monitor
Class ObjectFactory
java.lang.Object
frysk.gui.monitor.ObjectFactory
public class ObjectFactory
- extends Object
The factory instantiates an object using the information
stored in an XML node.
If an object is dynamically instantiated during runtime then
the written code does not know its type so the type must be saved
and the object dynamically instantiated again at load time. For this
purpose the saveObject/loadObject methods of ObjectFactory must
be used instead of directly calling the objects save/load.
It doesnt harm of course of objects were always saved/loaded using the
factory methods so one might as well do that for safety.
theFactory
public static final ObjectFactory theFactory
ObjectFactory
public ObjectFactory()
getObject
public Object getObject(Element node)
- Dynamically instantiates the object save to the given node,
- Parameters:
node
- the node form where to retrieved object information.
- Returns:
- the instantiated object. NULL if the object cannot be
loaded.
loadObject
public Object loadObject(Element node)
- Instantiates the object then calls its load function.
- Parameters:
node
- The node from wich to retrieve the information
- Returns:
- instantiated and loaded object
saveObject
public void saveObject(SaveableXXX saveable,
Element node)
exportNode
public void exportNode(File file,
Element node)
importNode
public Element importNode(File file)
deleteNode
public boolean deleteNode(File file)