wox.serial
Class Easy

java.lang.Object
  extended by wox.serial.Easy

public class Easy
extends java.lang.Object

The Easy class is used to serialize/de-serialize objects to/from XML. It has two static methods. The save method serializes an object to XML and stores it in an XML file; and the load method de-serializes an object from an XML file.

Version:
Easy.java - 1.0
Author:
Simon M. Lucas
Carlos R. Jaimez Gonzalez

Constructor Summary
Easy()
           
 
Method Summary
static java.lang.Object load(java.lang.String filename)
          This method loads an object from the specified XML file.
static void save(java.lang.Object ob, java.lang.String filename)
          This method saves an object to the specified XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Easy

public Easy()
Method Detail

save

public static void save(java.lang.Object ob,
                        java.lang.String filename)
This method saves an object to the specified XML file. Example:

ArrayList list = new ArrayList();
list.add(new Product("Beans", 500));
list.add(new Product("Bread", 200));
Easy.save(list, "list.xml");

Parameters:
ob - Any object.
filename - This is the XML file where the object will be stored.

load

public static java.lang.Object load(java.lang.String filename)
This method loads an object from the specified XML file. Example:

ArrayList list = (ArrayList)Easy.load("list.xml");

Parameters:
filename - The XML file where the object is stored.
Returns:
Object The live object.