KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > xstream > core > TreeMarshallingStrategy


1 package com.thoughtworks.xstream.core;
2
3 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
4 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
5 import com.thoughtworks.xstream.core.*;
6 import com.thoughtworks.xstream.alias.ClassMapper;
7 import com.thoughtworks.xstream.MarshallingStrategy;
8
9 public class TreeMarshallingStrategy implements MarshallingStrategy {
10
11     public Object JavaDoc unmarshal(Object JavaDoc root, HierarchicalStreamReader reader, DefaultConverterLookup converterLookup, ClassMapper classMapper) {
12         return new TreeUnmarshaller(
13                 root, reader, converterLookup,
14                 classMapper, converterLookup.getClassAttributeIdentifier()).start();
15     }
16
17     public void marshal(HierarchicalStreamWriter writer, Object JavaDoc obj, DefaultConverterLookup converterLookup, ClassMapper classMapper) {
18         new TreeMarshaller(
19                 writer, converterLookup, classMapper).start(obj);
20     }
21
22 }
23
Popular Tags