1 package org.kuali.ole.converters;
2
3 import com.thoughtworks.xstream.converters.Converter;
4 import com.thoughtworks.xstream.converters.MarshallingContext;
5 import com.thoughtworks.xstream.converters.UnmarshallingContext;
6 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
7 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
8 import org.kuali.ole.bo.explain.OleSRUExplainDatabaseTitle;
9
10
11
12
13
14
15
16
17 public class OleSRUExplainDatabaseInfoConverter implements Converter {
18
19
20 @Override
21 public void marshal(Object o, HierarchicalStreamWriter hierarchicalStreamWriter,
22 MarshallingContext marshallingContext) {
23 OleSRUExplainDatabaseTitle oleSRUExplainDatabaseTitle = (OleSRUExplainDatabaseTitle) o;
24 hierarchicalStreamWriter.addAttribute("lang", oleSRUExplainDatabaseTitle.getLang());
25 hierarchicalStreamWriter.addAttribute("primary", oleSRUExplainDatabaseTitle.getPrimary());
26 hierarchicalStreamWriter.setValue(oleSRUExplainDatabaseTitle.getValue());
27 }
28
29 @Override
30 public Object unmarshal(HierarchicalStreamReader hierarchicalStreamReader,
31 UnmarshallingContext unmarshallingContext) {
32
33 OleSRUExplainDatabaseTitle oleSRUExplainDatabaseTitle = new OleSRUExplainDatabaseTitle();
34 oleSRUExplainDatabaseTitle.setLang(hierarchicalStreamReader.getAttribute("lang"));
35 oleSRUExplainDatabaseTitle.setPrimary(hierarchicalStreamReader.getAttribute("primary"));
36 oleSRUExplainDatabaseTitle.setValue(hierarchicalStreamReader.getValue());
37 return oleSRUExplainDatabaseTitle;
38 }
39
40 @Override
41 public boolean canConvert(Class aClass) {
42 return aClass.equals(OleSRUExplainDatabaseTitle.class);
43 }
44 }