KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portal > skin > converter > StyleConverter


1 package org.exoplatform.services.portal.skin.converter;
2
3 import java.util.* ;
4 import org.exoplatform.services.portal.skin.model.*;
5
6 import com.thoughtworks.xstream.converters.Converter;
7 import com.thoughtworks.xstream.converters.MarshallingContext;
8 import com.thoughtworks.xstream.converters.UnmarshallingContext;
9 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
10 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
11
12 /**
13  * @author Tuan Nguyen
14  */

15 public class StyleConverter implements Converter {
16
17     public boolean canConvert(Class JavaDoc type) {
18         return type.equals(Style.class) ;
19     }
20
21     public void marshal(Object JavaDoc source, HierarchicalStreamWriter w, MarshallingContext context) {
22         Style style = (Style) source ;
23     }
24
25     public Object JavaDoc unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
26       Style style = new Style(reader.getAttribute("name"), reader.getAttribute("url")) ;
27         return style ;
28     }
29 }
Popular Tags