org.opensourcephysics.controls
Class XMLJavaLoader

java.lang.Object
  extended by org.opensourcephysics.controls.XMLJavaLoader
All Implemented Interfaces:
XML.ObjectLoader

public class XMLJavaLoader
extends java.lang.Object
implements XML.ObjectLoader

This is an ObjectLoader implementation that uses the Java XMLEncoder and XMLDecoder classes to save and load data.

Version:
1.0
Author:
Douglas Brown

Constructor Summary
XMLJavaLoader()
          Constructs the loader.
 
Method Summary
 java.lang.Object createObject(XMLControl control)
          Creates a new object if the class type has a no-arg constructor.
 java.lang.Object loadObject(XMLControl control, java.lang.Object obj)
          Loads an object with data from an XMLControl.
 void saveObject(XMLControl control, java.lang.Object obj)
          Saves XMLEncoder data for an object in the specified XMLControl.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLJavaLoader

public XMLJavaLoader()
Constructs the loader.

Method Detail

saveObject

public void saveObject(XMLControl control,
                       java.lang.Object obj)
Saves XMLEncoder data for an object in the specified XMLControl.

Specified by:
saveObject in interface XML.ObjectLoader
Parameters:
control - the control
obj - the object

createObject

public java.lang.Object createObject(XMLControl control)
Creates a new object if the class type has a no-arg constructor.

Specified by:
createObject in interface XML.ObjectLoader
Parameters:
control - the control
Returns:
the new object

loadObject

public java.lang.Object loadObject(XMLControl control,
                                   java.lang.Object obj)
Loads an object with data from an XMLControl.

Specified by:
loadObject in interface XML.ObjectLoader
Parameters:
control - the control
obj - the object
Returns:
the loaded object