frysk.gui.monitor
Class ObjectFactory

java.lang.Object
  extended by 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.


Field Summary
static ObjectFactory theFactory
           
 
Constructor Summary
ObjectFactory()
           
 
Method Summary
 boolean deleteNode(File file)
           
 void exportNode(File file, Element node)
           
 Object getObject(Element node)
          Dynamically instantiates the object save to the given node,
 Element importNode(File file)
           
 Object loadObject(Element node)
          Instantiates the object then calls its load function.
 void saveObject(SaveableXXX saveable, Element node)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theFactory

public static final ObjectFactory theFactory
Constructor Detail

ObjectFactory

public ObjectFactory()
Method Detail

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)