|
|
|
import com.thoughtworks.xstream.XStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class MainXStreamExample {
public static void main(String[] args) {
//Instantiate XStream
XStream xstream = new XStream();
Job job = new Job("SSE", 10000.60f);
List<String> curr = new ArrayList<String>();
curr.add("INR");
curr.add("USD");
job.setCurrency(curr);
//Instantiate and initialize any domain object of yours
User user = new User(1, "Nitin Agrawal", new Date(System.currentTimeMillis()), job);
//Convert your domain object to XML instantly with a single statement call!
System.out.println(xstream.toXML(user));
//Get the data from XML
User getUser = (User) xstream.fromXML(xstream.toXML(user));
System.out.println(getUser.getJob().getJob());
}
}
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class MainXStreamExample {
public static void main(String[] args) {
//Instantiate XStream
XStream xstream = new XStream();
Job job = new Job("SSE", 10000.60f);
List<String> curr = new ArrayList<String>();
curr.add("INR");
curr.add("USD");
job.setCurrency(curr);
//Instantiate and initialize any domain object of yours
User user = new User(1, "Nitin Agrawal", new Date(System.currentTimeMillis()), job);
//Convert your domain object to XML instantly with a single statement call!
System.out.println(xstream.toXML(user));
//Get the data from XML
User getUser = (User) xstream.fromXML(xstream.toXML(user));
System.out.println(getUser.getJob().getJob());
}
}