Class XMLJavaLoader

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

public class XMLJavaLoader extends 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 Details

    • XMLJavaLoader

      public XMLJavaLoader()
      Constructs the loader.
  • Method Details

    • saveObject

      public void saveObject(XMLControl control, 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 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 Object loadObject(XMLControl control, 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